On Fri, Jul 12, 2019 at 02:26:52PM -0400, Chet Ramey wrote: > Date: Fri, 12 Jul 2019 14:26:52 -0400 > From: Chet Ramey <chet.ra...@case.edu> > To: Mike Jonkmans <bash...@jonkmans.nl>, bug-bash@gnu.org, > b...@packages.debian.org > Cc: chet.ra...@case.edu > Subject: Re: background, pipeline, hang > Reply-To: chet.ra...@case.edu > > On 7/12/19 10:00 AM, Mike Jonkmans wrote: > > > Bash Version: 4.4 > > Patch Level: 20 > > Release Status: release > > > > Description: > > A pipeline, with two or more pipes, hangs when a background job is > > running. > > Only when the background job finishes, the shell prompts again. > > Without the background job, the shell prompts immediately. > > > > Repeat-By: > > : | : | : ## immediately finishes > > sleep 10 & > > : | : | : ## this hangs (^C, ^\, ^Z do not help) until the sleep > > finishes > > Sorry, I can't reproduce this. > > Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
Thanks for looking, though. With the tip of Greg Wooledge (use --norc --noprofile), from another post, i was able to research this further. This runs for two seconds: bash --norc --noprofile -ic "trap 'tput hs' DEBUG; sleep 2 & :|:|:" While this immediately finishes: bash --norc --noprofile -ic "trap ':' DEBUG; sleep 2 & :|:|:" I also found something in the (ubuntu)changelog, that might be related. Quotes from "apt-get changelog bash": bash (4.3-6) unstable; urgency=medium [...] * Apply upstream patches 001 - 008: [...] - A change to save state while running the DEBUG trap caused pipelines to hang on systems which need process group synchronization while building pipelines. It seems to have to do with the duration of the command executed in the DEBUG trap. As this also exhibits an unexpected, longer duration: bash --norc --noprofile -ic "trap 'sleep 1; echo $SECONDS' DEBUG; sleep 5 & :|:|:"; echo $SECONDS Compared to: bash --norc --noprofile -ic "trap 'echo $SECONDS' DEBUG; sleep 5 & :|:|:"; echo $SECONDS So this combination is problematic: - trap on DEBUG where the command takes some time - something running in the background - a pipeline with two or more pipes Hope you can make something of this. Regards, Mike