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: Helmut Karlowski
Subject: Re: redirection inside a process-substitution
Date: Sat, 27 Aug 2016 02:35:08 +0200
User-agent: Opera Mail/12.17 (Win32)

Am 24.08.2016, 18:00 Uhr, schrieb Chet Ramey:

echo > >(echo 3 1>&3)
echo +++++
cat tb.err
echo -----
wait

I get in bash:

Strange.  I get

+++++
1
-----
+++++
11
-----
+++++
-----
2
+++++
2
3
-----

on Mac OS X and RHEL 6.  I'm not sure why the last redirection (the one
with just process substitution and not 3>&1) doesn't cause the file to
be truncated, or the file pointer to be adjusted, but the trace is the
same in all cases.

I think because the redirection goes to a process, not a file.

in zsh (sometimes, sometimes it prints nothing):

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.

In my test bash got killed by SIGPIPE. Maybe you can reproduce it with:

#trap 'echo PIPE' PIPE
{ sleep 1; echo bla; } > >(echo r4 )
echo ---------------

When I uncomment the first line bash gets into real trouble:

obash bashbug.txt
bashbug.txt: line 3: echo: write error: Broken pipe
bashbug.txt: line 1: echo: write error: Broken pipe
bashbug.txt: line 1: echo: write error: Broken pipe

....

endlessly.


-Helmut


--



reply via email to

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