bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: redirection inside a process-substitution


From: Stephane Chazelas
Subject: Re: redirection inside a process-substitution
Date: Mon, 29 Aug 2016 14:04:19 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

2016-08-27 02:35:08 +0200, Helmut Karlowski:
[...]
> >I speculate that this has to do with something that zsh does to force
> >appending, whether that's lseek or something else, other than the fact
> >that zsh doesn't seem to use /dev/fd at all (I think it just straight
> >uses pipes).  Bash doesn't do anything special with tb.err after opening
> 
> zsh uses temp-files for all process-substitution, which limits it's
> features but is easier to do.
[...]

No, zsh only uses temp files for the =(...) form of process
substitution. For <(...) and >(...), it uses pipes and /dev/fd/x
or named pipes if the system doesn't support /dev/fd/n like for
bash. On cygwin:

$ zsh -c 'ls -ld <(:)'
prw------- 1 user None 0 Aug 29 13:52 /tmp/zshNyQjeh

It does use named pipes (not files), possibly that version of
zsh was built before /dev/fd/x support was added to cygwin. On
Linux:

$ zsh -c 'ls -ld <(:)'
lr-x------ 1 user group 64 Aug 29 13:54 /proc/self/fd/12 -> pipe:[81899]


For > >(file), it optimises the pipe()+open("/dev/fd/x") by
doing the pipe alone.

In anycase, whether it's unnamed or named pipes, it's functionaly
equivalent. The difference between bash and zsh I suppose here
is down to the order in which the files are open.

-- 
Stephane



reply via email to

[Prev in Thread] Current Thread [Next in Thread]