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]

Re: Problem with cat under bash shell


On Sep 16 10:47, Lionel Barnett wrote:
>  --- Corinna Vinschen <corinna-cygwin@cygwin.com> wrote: 
> > > /netrel/src/cygwin-1.5.11-1/winsup/cygwin/fhandler.cc:263 windows
> > error
> > > 59
> > >   756  122627 [main] cat 2668 geterrno_from_win_error: unknown
> > windows
> > > error 59, setting errno to 13
> > 
> > That looks really weird.  Did you notice that win32 error 59 means
> > "An unexpected network error occurred." ?
> 
> Yes, I was aware of that.
> 
> > Does that give a hint to you?
> 
> Um, not really... except that it appears the problem doesn't arise if
> /tmp is accessed locally rather than over the network. However, I
> constantly read/write/execute files all over the network via Cygwin
> tools and have not encountered any problems previously. Is there
> something special about /tmp that I am not aware of?

I just curiously tried to reproduce the effect and it was pretty simple.
I'm not quite sure, but it seems to be a strange interaction between
remote file handling under windows, coupled with the way the temporary
file is handled by bash.

What bash does is this:  It opens a temporary file in /tmp which gets
everything you type into the here script up to the EOF.  Then it
duplicates the handle to become stdin for the still to be called `cat'
process.  Next, it unlinks the file.  Unlink is implemented as
  
   h=CreateFile(FILE_FLAG_DELETE_ON_CLOSE);
   CloseHandle(h);

This should result in removing the file as soon as all open handles to
the file are closed.  That works, but for some reason also the ReadFile
call in cat fails as above.

I don't know how to fix this right now, but the workaround is simply
to have /tmp always be a local directory.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
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]