Mail Archives: cygwin/2005/09/29/08:18:04
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Corinna Vinschen on 9/29/2005 1:50 AM:
>>The fix to rmdir(2) is easy - check for a trailing / or /. or /..
>>before handing the name off to the complex path processing
>>code, and fail with EINVAL if so. rmdir(2) isn't called often
>>enough for this to slow down everything else, and there are
>>no Windows API calls in this failure mode, and in return you
>>get POSIX compliance.
>
>
> Just a trailing slash is fine, btw. Try this on any POSIXy system.
It is still inconsistent on POSIXy systems - compare Solaris 8 vs. Solaris 10:
8> mkdir a
8> ln -s a b
8> rmdir b/
rmdir: directory "b/": Path component not a directory
10> mkdir a
10> ln -s a b
10> rmdir b/
10> ls ?
b
However, I'm not sure in Solaris 8 whether the trailing slash was removed
by rmdir(1) before calling rmdir(2), or whether rmdir(2) errored out with
ENOTDIR. But Solaris 10 certainly removed the referrant directory,
leaving the symlink dangling.
Further discussion on the coreutils list pointed out that POSIX has some
holes in this area (a strict reading of "rm -R symlink/", for example,
would remove the contents of the referrant directory, then fail with
EINVAL, but obviously no system does that - they just remove symlink and
leave the referrant directory intact). In light of the misunderstandings
in interpreting POSIX, and the various behaviors on different POSIXy
platforms, I'm now in the process of asking the Austin group for
clarification (with a goal of mandating, or at least allowing, existing
behavior, where it is different from a strict reading of the
specification). So for now I agree that you only need to check for
explicit trailing . or .., and don't worry about trailing / until the next
version of POSIX better defines what can/should be done.
- --
Life is short - so eat dessert first!
Eric Blake ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDO9tt84KuGfSFAYARAmuTAKDQSxOctFpFJW5mukyYCdzIlNy1owCgvsLJ
f0wQVl/Go1ToSGYy+TOm4/0=
=WY/e
-----END PGP SIGNATURE-----
--
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/
- Raw text -