[WBEL-users] bash causes sporadic job control output

Kirby Bohling kbohling@birddog.com
Tue, 20 Jul 2004 20:41:10 -0500


On Tue, Jul 20, 2004 at 10:29:19AM -0600, Alan Sparks wrote:
> This is kinda baffling me... can not duplicate it on any other Linux
> dist (such as RH 7.2 or Fedora Core 2).  Not the best place to ask, but
> seems only symptomatic on WBEL.
> 
> I have a script that is producing output like the following:
> $ mtabacklog |head
>      22 belsouth.net
>      20 verison.net
>      20 hotamil.com
>      18 yohoo.com
>      18 yaho.com
>      16 yhoo.com
>      16 hotmail.
>      12 earhtlink.net
>      10 aol.ocm
>      10 aol.comy
> /home/asparks/bin/mtabacklog: line 7:  3810 Done                   
> mailq -v
>       3811                       | perl -n -e '/^\s+\<.*\@(.*)\>/ &&
> print "$1\n"'
>       3812                       | sort
>       3813                       | uniq -c
>       3814 Broken pipe             | sort -nr

I've got a setup that will easily reproduce this without any other
extranous stuff, all the sendmail/perl/sort stuff is extraneous:

create a script named bar.sh, that has the following contents:
#!/bin/sh

dd if=/dev/zero bs=5k count=1 | cat | cat | cat
# End of bar.sh.

(Side note: for this to happen, you have to fill the buffer, in
Linux the default pipe size is 4k, so I write 5k to be sure that the
pipeline will have to block, if you do this on a different OS,
you'll need to be sure that you fill the pipe buffer).

Now run this:
[root@hermes /root]# ./bar.sh | dd bs=1k count=1
1+0 records in
1+0 records out
1+0 records in
1+0 records out
./bar.sh: line 3: 17212 Done                    dd if=/dev/zero bs=5k count=1
     17213                       | cat
     17214                       | cat
     17215 Broken pipe             | cat

	I get the same problem on RHEL2.1, WBEL3.0, RH7.2, RH7.1.  I
don't have any RH 7.3/8.0/9 machines handy.  However, on RH6.2 does
*NOT* have this problem.  That's probably because it's bash v1,
instead of bash v2.

After looking into the error, I found out it's actually a FAQ:

http://lists.gnu.org/archive/html/bug-bash/2003-03/msg00083.html

Look for question E2.

So I'd say this is a "Works as Designed (WAD)" issue.  There is a
way to disable that, but it's a compile time issue.

	Thanks,
		Kirby