Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Jeremy Townshend Newsgroups: gnu.bash.bug Subject: trap - inconsistent behaviour Date: Fri, 21 Sep 2018 00:39:57 +0100 Lines: 38 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1537491435 14792 208.118.235.17 (21 Sep 2018 00:57:15 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org, bash@packages.debian.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=QfBnBgVrx1OxkRRA/qPzacE/fkITnfZbrbXLdVcL5m8=; b=Rba1bVcH5DOZivwA96K3HeLWsjTRQkW8FZvq2xqyHT6jX1/vheOd9piMNEoHfeN+ZO ZkwbfNOoIVG65qPrwgzj3Hy8BXlMj+f/BBf2XqRAvPMQt52Zwzcs02JluGtKdP9uE+Ey eIB+7yYODsJJ4ftdXVqYnUMolKCrIUCNJen2sTQdXwBvGzijoZnNcfsNYsC3T6xjjNq/ l2dtlumqOba8/sN6ozdQwLqXU8ytVFZqw/3TptcVmiFLs9qvylb7ZiculdLtn7x7WgBp nyGLzJkw9dFdj3LoDwtWHcK99+dEotJszqb7k63TFOR4LLLgsHbmfWcnQCZFVQ3YNY2z Z5ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=QfBnBgVrx1OxkRRA/qPzacE/fkITnfZbrbXLdVcL5m8=; b=hWyvJwvEAZDE3Gii/f8mERczc2EFlfzQpj7FGseW29V4jziezlUTcuGPDKXuGX020F uuvxKya/Fo8FI1pB8hhBMHYiJZa2VXssDvHV7EMrwQTyfJpsDKgDrYH29QdzeHaNtAk9 ps8mVcDJ9W1e5L+CSlR8T+n12GI1Xc8t9d5zcExxfuFR+dqlC8BeL4nGz8BAnxtvg7Yx 0WI4D4IV2FO5hBnUnPrbIh8/5kcgCgXR7Zzi6tFPd8SwQgoi0uvahpFWnHnX0LspRB7o /AsR7Fig4zjf37BCg3CQWquQzsnge0Oh5MeRiHmMTFviElU+j9e8TO5UYWgLVmAGnKa0 7/FA== X-Gm-Message-State: APzg51Cl2oW9AUX+aWRqrWXr2nUMncV7emYisV1jaktMG+yiiA914xTB ziWw8M3uaQPUitgGOrPneh2cjgNZ X-Google-Smtp-Source: ANB0VdYwj+XgA8Q9GfUuws1sQJJn1lQQ0urBs/brFnC6D60ge9Yx+XTtZIMuFdYzdyZ7zyFIQAMgtw== X-Received: by 2002:adf:e910:: with SMTP id f16-v6mr36364189wrm.126.1537486800831; Thu, 20 Sep 2018 16:40:00 -0700 (PDT) Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 X-Mailman-Approved-At: Thu, 20 Sep 2018 20:57:13 -0400 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14616 Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-vEMnMR/bash-4.4.18=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname output: Linux tower 4.15.0-32-generic #35-Ubuntu SMP Fri Aug 10 17:58:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 4.4 Patch Level: 19 Release Status: release Description: The behaviour of the "trap" builtin command changes merely by printing the list of commands associated with each signal (trap command issued without arguments). Repeat-By: Case 1: In a fresh terminal emulator issue the following: ( trap 'echo trapped >&2' HUP; { sleep 10 & sleepPID=$!; wait $sleepPID; } > >( sleep 1; kill -HUP $BASHPID; cat ) ) Case 2: Then in a fresh terminal emulator issue the following: ( trap 'echo trapped >&2' HUP; { sleep 10 & sleepPID=$!; wait $sleepPID; } > >( trap; sleep 1; kill -HUP $BASHPID; cat ) ) Expected outcome: either the trap is triggered in both cases or in neither since the only difference is the additional trap command with no arguments (for printing the list of commands associated with each signal). That is, in this case, "trapped" is expected to be printed in both cases or in neither case. Actual outcome: the trap is not triggered in the first instance but is triggered in the second. Real use case: where zenity --progress --auto-kill is issuing the kill -HUP as a result of the cancel button being pressed.