symlinks to unlinked but open files should work
Helmut Karlowski
helmut.karlowski@ish.de
Sun Jul 3 11:48:00 GMT 2016
Am 03.07.2016, 13:14 Uhr, schrieb Corinna Vinschen:
> 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
I noticed that too meanwhile, but I thought you would not need that
information ;)
It's only about the /dev/fd-symlinks, otherwise cygwin seems to be
correct: they don't work anywhere on an open but deleted file:
ln -sf out1 lout1
exec >out1
[[ -w lout1 ]] || echo lout1 not writable-1 1>&2
rm out1
[[ -w lout1 ]] || echo lout1 not writable-2 1>&2
rm lout1
correctly prints the second message.
> 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.
Not a big issue - I don't know any situation this would break except the
above /dev/fd-test.
-Helmut
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list