This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: symlinks to unlinked but open files should work
- From: "Helmut Karlowski" <helmut dot karlowski at ish dot de>
- To: cygwin at cygwin dot com
- Date: Sun, 03 Jul 2016 13:48:17 +0200
- Subject: Re: symlinks to unlinked but open files should work
- Anomaly-results: submit.unitybox.de; rate=0%
- Authentication-results: sourceware.org; auth=none
- Dubio-filter: Adamant Filter v2016.04.1 submit.unitybox.de 3rj7h26Plhz6dtC2
- References: <op dot yjxvo5gyofd6j1 at frascati dot upc dot de> <20160703111436 dot GA6301 at calimero dot vinschen dot de>
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