From d85d34d8183a8a45bfb09c4242ef9368860be6d9 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 17 Apr 2000 10:57:48 +0000 Subject: 10789: <(...) and >(...) documentation --- ChangeLog | 3 +++ Doc/Zsh/expn.yo | 30 ++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d60db4df..1db9472ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2000-04-17 Peter Stephenson + * 10789: Doc/Zsh/expn.yo: better documentation for <(...) and + >(...) implementations and their drawbacks. + * Chmouel: 10772: Completion/Linux/_rpm: --target support. 2000-04-17 Sven Wischnowsky diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index 8d32500b4..50021ed0d 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -278,13 +278,13 @@ Each command argument of the form `tt(=LPAR())var(list)tt(RPAR())' is subject to process substitution. In the case of the tt(<) or tt(>) forms, the shell will run process -var(list) asynchronously, connected to a named pipe (FIFO). -The name of this pipe will become the argument to the command. -If the form with tt(>) -is selected then writing on this file will provide input for var(list). -If tt(<) is used, then the file passed as an argument will -be a named pipe connected to the output of the var(list) process. -For example, +var(list) asynchronously. If the system supports the tt(/dev/fd) +mechanism, the command argument is the name of the device file +corresponding to a file descriptor; otherwise, if the system supports named +pipes (FIFOs), the command argument will be a named pipe. If the form with +tt(>) is selected then writing on this special file will provide input for +var(list). If tt(<) is used, then the file passed as an argument will +be connected to the output of the var(list) process. For example, nofill(tt(paste LPAR())var(process1)tt(RPAR() >LPAR())var(process2)tt(RPAR() >/dev/null)) @@ -292,9 +292,19 @@ tee >LPAR())var(process1)tt(RPAR() >LPAR())var(process2)tt(RPAR() >/dev/null)) cuts fields 1 and 3 from the files var(file1) and var(file2) respectively, pastes the results together, and sends it to the processes var(process1) and var(process2). -Note that the file, which is passed as an argument to the command, -is a system pipe, so programs that expect to lseek (see manref(lseek)(2)) -on the file will not work. + +Both the tt(/dev/fd) and the named pipe implementation have drawbacks. In +the former case, some programmes may automatically close the file +descriptor in question before examining the file on the command line, +particularly if this is necessary for security reasons such as when the +programme is running setuid. In the second case, the file passed as an +argument to the command is a system pipe, so programs that expect to lseek +(see manref(lseek)(2)) on the file will not work; furthermore, if the +programme does not actually open the file the subshell attempting to read +from or write to the pipe will (in a typical implementation, different +operating systems may have different behaviour) block for ever and have to +be killed explicitly. + Also note that the previous example can be more compactly and efficiently written (provided the tt(MULTIOS) option is set) as: -- cgit 1.4.1