cc: [email protected]
Subject: Re: [ast-developers] [ksh] problems with pipes and redirections
--------

> ~$ ksh --version
>   version         sh (AT&T Research) 93t+ 2009-05-01
> 
> (btw:
> http://www2.research.att.com/sw/download/
>      09-07-01  --- Release ksh93t+  ---
> is it my packaged version of ksh that has got a problem with the
> date? (debian unstable x86package version 93t+-2, same with
> ubuntu karmic amd64 93t+-2))
> 
> 
> $ echo test <&-
> ksh: open file limit exceeded
Fixed.
> $ ksh -c 'echo test <&-'
> test
> $ sleep 10 | : <&-
> ksh: open file limit exceeded
Fixed.
> $ : <&-
> $ echo 100 | ls -l /dev/fd/3 3<&0 <&-
> ksh: open file limit exceeded
Fixed.
> $ echo 100 | cat /dev/fd/3 3<&0
> cat: /dev/fd/3: No such device or address
> $ echo 100 | ls -l /dev/fd/3 3<&0
> lrwx------ 1 chazelas chazelas 64 2009-11-13 10:42 /dev/fd/3 -> socket:[27565]
> 
> What's that business of using Unix domain sockets for pipes?! I
> see nothing in the RELEASE file about that change.
ksh93 uses sockets for pipes on systems that don't have the ability to peek
ahead at pipe data.  The reason for this is to allow the shell to read more
than one byte at a time for
        command | while read;do ...;done
This gives an order of magnitude improvement in performance.

Since 3 is a dup of 0, /dev/fd/3 should be equivalent to /dev/fd/0
which it isn't on Linux.   This is a Linux bug.
> 
> Also:
> 
> $ sleep 3 | :
> 
> does sleep for 3 seconds, but:
> 
> $ sleep 3 | cat < /dev/null
> or
> $ sleep 3 | cat 3<&0 < /dev/null
> 
> do not, and a sleep process is left running in the background.
> 
> That behavior is POSIX conformant as the shell is only required
> to wait for the last command, but not very consistent. Why wait
> for sleep in the first case and not in the second?
This looks like a bug.  When monitor mode is on or pipefail is on, ksh is
supposed to wait for the pipeline to complete.  I will fix for the next update.
> 
> 
> -- 
> Stephane
> 
> 

David Korn
[email protected]
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to