Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11710

Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail
From Linda Walsh <bash@tlinx.org>
Newsgroups gnu.bash.bug
Subject Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?
Date Mon, 19 Oct 2015 12:49:25 -0700
Lines 61
Approved bug-bash@gnu.org
Message-ID <mailman.654.1445284185.7904.bug-bash@gnu.org> (permalink)
References <56218DA5.8030501@tlinx.org> <5622CDC8.2030102@case.edu> <5622EB23.6020700@tlinx.org> <20151019122800.GS27325@eeg.ccf.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1445284185 26855 208.118.235.17 (19 Oct 2015 19:49:45 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Greg Wooledge <wooledg@eeg.ccf.org>
To bug-bash <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
User-Agent Thunderbird
In-Reply-To <20151019122800.GS27325@eeg.ccf.org>
X-MIME-Autoconverted from 8bit to quoted-printable by Ishtar.hs.tlinx.org id t9JJnPHC036897
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic]
X-Received-From 173.164.175.65
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11710

Show key headers only | View raw



Greg Wooledge wrote:
> On Sat, Oct 17, 2015 at 05:43:15PM -0700, Linda Walsh wrote:
>> Chet Ramey wrote:
>>> I think you're missing that process substitution is a word expansion
>>> that is defined to expand to a filename.
>> -----
>> 	??? I've never seen a usage where it expands to a filename and
>> is treated as such.
> 
> A simple example:
> 
> diff -u <(sort file1) <(sort file2)
----
	You claim <(sort file1) is a filename?

> touch a
> mv <(sort a) <(sort a)         
mv: cannot move ‘/dev/fd/63’ to ‘/dev/fd/62’: Operation not permitted 

The OS claims that <() generates a file descriptor -- not a filename.

"<()" is not the same, nor equivalent to a filename.  It represents
a *file descriptor* that you can perform stream I/O on.  

It's the same with 'FILENAME'a used with "read < FILENAME >FILENAME"

> read < FILE > FILE
-bash: FILE: No such file or directory   # no file is created by '>'
> echo content >FILE
> read mycontent < FILE >FILE
> echo $mycontent			# empty: file truncated before read
> a=<(sort a); chmod +x "$a"
chmod: cannot access ‘/dev/fd/63’: No such file or directory
> echo aaa > a
> read var <(sort a) && echo "var=$var" >a

## the above hangs: if <(sort a), was a filename, read would
## have read 'aaa' ## from it, and returned immediately.  
## Then the 'echo' command would have put 'var=aaa' 
## in 'a': instead:
> cat a
aaa

The above operations show that <() is not equivalent to a filename.
It only returns a 'path' to a *device* that doesn't have file semantics
and can only be opened for read... and even that doesn't
appear to work all the time.

I observe similar inconsistencies and confusion around
the use of 'dynamic vars' -- not really being global, not really
being local, but supposedly on some dynamic frame, "somewhere",
but not anywhere they've been declared or used.




Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes? Linda Walsh <bash@tlinx.org> - 2015-10-19 12:49 -0700

csiph-web