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

> ~$ 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  in recent versions
> $ ksh -c 'echo test <&-'
> test
> $ sleep 10 | : <&-
> ksh: open file limit exceeded
fixed  in recent versions
> $ : <&-
> $ echo 100 | ls -l /dev/fd/3 3<&0 <&-
> ksh: open file limit exceeded
fixed  in recent versions
the output is
sr--------   1 dgk      dgk             0 Dec 31 19:00 /dev/fd/3
> $ echo 100 | cat /dev/fd/3 3<&0
> cat: /dev/fd/3: No such device or address
This problem is still there.  I think that this is a linux bug since
/dev/fd/3 exists and is a socket.
> $ 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.
This is an implementation detail not required by the documentation.
There is no way to peek ahead on a pipe as there is with a socket
so that the shell must read a byte at a time for
        command | while read -r
        do      if [[ $REPLY == $pattern ]]
                then    cat
                        break
                fi
        done
so that the cat command has standard input positioned correctly.
With the ability to peek, the shell can read a line at a time
which is an order of magnitude faster.
> 
> 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?
The all sleep for 3 seconds in the current release at least when
cat is a built-in.

I am not sure that any of these should delay unless PIPEFAIL is on.
> 
> 
> -- 
> Stephane
> 
> 
> _______________________________________________
> ast-developers mailing list
> [email protected]
> https://mailman.research.att.com/mailman/listinfo/ast-developers
> 

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

Reply via email to