This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Ref http://www.cygwin.com/ml/cygwin/2005-04/msg00651.html


Hi,

referring http://www.cygwin.com/ml/cygwin/2005-04/msg00651.html

I have a comment,

the problem seems to be more of a general kind(files that doesn't exist already don't get created for writing) as these things happen on my Cygwin system (running under Server 2003):

This is the new thing I've found, note that without the pipe(i.e. | cat) the command runs just fine:

tar -cf /proc/self/fd/1 syntax.c | cat
tar: /proc/self/fd/1: Cannot write: Bad file descriptor
tar: Error is not recoverable: exiting now

and this is what happens on my system with the command referred in the link above, note that the error messages are the same!


$ tar -cf >(cat) syntax.c
tar: /proc/self/fd/63: Cannot write: Bad file descriptor
tar: Error is not recoverable: exiting now

Both of these commands effectively creates a temporary file for both reading and writing and that seems to be the problem, this command runs just fine because I create a file for writing:


$ tar -cf >(cat) syntax.c 63>temp

and, once created, this command runs fine too, however note that the redirection of input also redirects output though it really shouldn't (try it without having the temp file first, and then with an empty temp file and check the contents afterward):


$ tar -cf >(cat) syntax.c 63<temp

So without the temp file, this fails every time:


$ tar -cf >(cat) syntax.c 63<temp 63>temp
bash: temp: No such file or directory

But this always works:


$ tar -cf >(cat) syntax.c 63>temp 63<temp

Writing to temp gives >(cat temp) nothing to read:


$ tar -cf >(cat temp) syntax.c 63>temp 63<temp

$ tar -cf >(cat temp) syntax.c 63<temp 63>temp

However there is obviously also something wrong with the redirection of standard input for
(cat) because I get no output with either of these statements even after the temp file is created (writing to temp2 while attempting to read from temp):

$ tar -cf >(cat) syntax.c 63>temp2 63<temp

$ tar -cf >(cat) syntax.c 63<temp 63>temp2

So only these gives the expected output:


$ tar -cf >(cat temp) syntax.c 63>temp2 63<temp

$ tar -cf >(cat temp) syntax.c 63<temp 63>temp2

Hope this helps in pinpointing the problem.



Regards, Anders Brandén



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]