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: symlinks to unlinked but open files should work

On Jul  1 22:40, Helmut Karlowski wrote:
> Cygwin seems to look up a symlink wrong:
> When the target-file is unlinked while it is used by a process the file
> still exists and the symlink should point to that file.
> Test:
> ln -s out1 lout1
> exec >lout1
> rm out1
> [[ -w /dev/fd/1 ]] || echo /dev/fd/1 not writable 1>&2
> rm lout1
> Only on cygwin it prints the message.

You don't even need a symlink.  This will show the same result:

  exec >out1
  rm out1
  [[ -w /dev/fd/1 ]] || echo /dev/fd/1 not writable 1>&2

In Cygwin we move a deleted but still open file out of the way (into
the trash) so the path is incorrect afterwards but even if we wouldn't
do that, the underlying problem can't be solved:

The problem is that a deleted file in Windows can't be opened anymore.
If you translate the above -w <file> into a libc call access
("/dev/fd/1", W_OK) or its Windows equivalent, that call will always
fail on a deleted file.  Same for open/CreateFile, etc.

Sorry, but off the top of my head I don't see a feasible workaround for
this problem.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature

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