FYI,
This script segfaults on opensolaris 5.11 snv_134 i86pc:
#!/bin/sh
rm -f x && \
echo y | sed -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, \
-e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, \
-e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, \
-e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, | cat
$ sh -x ~/sh-abuse
+ rm -f x
+ echo y
Segmentation Fault (core dumped)
[Exit 139 (SIGSEGV)]
If I tweak it slightly, say by changing "x" to "xxx", it does this:
+ rm -f xxx
+ echo y
+ sed -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e
s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e
s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e
s,,, -e s,,, -e s,,, -e s,,,
+ cat
and hangs, waiting for input from *me*.
If I type ^D, it terminates with no further output.
If instead, I change the "rm -f x" to something shorter,
like "echo", it does this:
+ echo
+ echo y
+ cat
If I remove one of the "-e s,,," pairs, it actually runs sed
and diagnoses a problem:
+ rm -f xxx
+ echo y
+ sed -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e
s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e
s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e s,,, -e
s,,, -e s,,, -e s,,,
sed: -e expression #31, char 0: no previous regular expression
+ cat
All of this to say you probably don't want to use
that version of /bin/sh on solaris 5.11.
This is relevant because a default coreutils build
uses /bin/sh to create files like gnulib's lib/stdlib.h
using sed commands with many -e arg pairs like the above.
For me, "make" hung with a pipeline like the above waiting
for tty input. Using "make SHELL=bash" worked around it.