On Wed, Aug 19, 2009 at 11:08:33PM +0200, Roland Mainz wrote:
>
> Hi!
>
> ----
>
> The following test should print two "PIPED" lines to stderr when the
> SIGPIPE signal occurs:
> -- snip --
> $ ksh93 -c 'g="false" ; trap "print -u2 PIPED ; \$g && exit 0 ; g=true"
> PIPE ; while true ; do echo hello ; done' | head
> -- snip --
I can redo this if I use a tcsh as interactive shell but not with
an interactive bash nor interactive ksh.
The main difference are the choosen stdin/stdout/stderr file
descriptors:
BUILD/ksh93> ll /proc/$$/fd
total 0
lrwx------ 1 werner suse 64 Aug 21 13:30 0 -> /dev/null
lr-x------ 1 werner suse 64 Aug 21 14:08 1 -> /dev/null
lrwx------ 1 werner suse 64 Aug 21 14:08 15 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 13:30 16 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 14:08 17 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 14:08 18 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 14:08 19 -> /dev/pts/21
lr-x------ 1 werner suse 64 Aug 21 14:08 2 -> /dev/null
BUILD/ksh93> bash
wer...@boole:/abuild/buildsystem.boole.werner/usr/src/packages/BUILD/ksh93>
ll /proc/$$/fd
total 0
lrwx------ 1 werner suse 64 Aug 21 14:08 0 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 14:09 1 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 14:09 2 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 14:09 255 -> /dev/pts/21
wer...@boole:/abuild/buildsystem.boole.werner/usr/src/packages/BUILD/ksh93>
exit
BUILD/ksh93> ksh
wer...@boole:/abuild/buildsystem.boole.werner/usr/src/packages/BUILD/ksh93>
ll /proc/$$/fd
total 0
lrwx------ 1 werner suse 64 Aug 21 14:09 0 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 14:09 1 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 14:09 2 -> /dev/pts/21
lrwx------ 1 werner suse 64 Aug 21 14:09 3 -> /suse/werner/.kshrc_history
and indeed if I add
exec 0<>/dev/tty 2>&0;
as first command in the above commands string all went OK.
Therefore I guess that ksh is trying to flush() a hard
coded file descriptor like stderr=2 instead of the real
file descriptor for stderr.
Werner
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users