[darcs-users] shell scripting sucks

Matthias Kilian kili at outback.escape.de
Fri Dec 5 07:02:16 UTC 2008


On Sun, Nov 09, 2008 at 05:58:57PM +0100, Petr Rockai wrote:
> Matthias Kilian <kili at outback.escape.de> writes:
> 
> > I'm not sure wether I'm understanding the problem correctly (I
> > didn't the complete thread), but if all you need is a yes for a
> > shell script when there's no yes(1) is installed, you could just
> > use a small function:
> No, the problem is that using yes(1) hangs the testsuite on certain
> setups. This was to disallow using yes(1) altogether and force
> test writers to go about the issue differently. The implementation
> you suggest might have the same issue as the original yes, I
> reckon.

FYI: the problem with yes(1) hanging is just an ignored SIGPIPE.
Wether SIGPIPE is ignored or not depends on from where the shell
is invoked.  For example, when I run yes | head from within an xterm
launched from xmonad, which in turn is run from ~/.xsession, it
hangs, whereas it doesn't hang when run from the console of from a
screen(1) session.

This can be fixed by resetting the SIGPIPE handler to the default
using trap - PIPE.

Ciao,
	Kili


More information about the darcs-users mailing list