+2015-05-28 Pádraig Brady <P@draigBrady.com>
+
+ unlinkat: handle ignoring of ".." on Darwin 14
+ * lib/unlinkat.c: unlinkat() has the same bug as unlink()
+ on Mac OS X 10.10, where it ignores paths with a trailing "..",
+ so handle in the same manner.
+ * m4/unlinkat.m4: Comment on this Darwin issue.
+ * doc/posix-functions/unlink.texi: Update the latest version
+ where the issue was seen.
+ * doc/posix-functions/unlinkat.texi: Mention this issue.
+ Fixes a test failure in test-unlinkat.c.
+
2015-05-27 Paul Eggert <eggert@cs.ucla.edu>
qacl: split into qcopy-acl and qset-acl
Some systems mistakenly succeed on @code{unlink("link-to-file/")}:
GNU/Hurd, FreeBSD 7.2, AIX 7.1, Solaris 9.
@item
-On Mac OS X 10.5.6, in a writable HFS mount, @code{unlink("..")} succeeds
+On Mac OS X 10.10, in a writable HFS mount, @code{unlink("..")} succeeds
without doing anything.
@end itemize
AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin 1.5.x, mingw, MSVC 9, Interix 3.5, BeOS.
But the replacement function is not safe to be used in libraries and is not multithread-safe.
@item
+On Mac OS X 10.10, in a writable HFS mount, @code{unlinkat(fd, "..", 0)} succeeds
+without doing anything.
+@item
Some systems mistakenly succeed on @code{unlinkat(fd,"file/",flag)}:
GNU/Hurd, Solaris 9.
@item
# undef unlinkat
-/* unlinkat without AT_REMOVEDIR does not honor trailing / on Solaris
- 9. Solve it in a similar manner to unlink. Hurd has the same
- issue. */
+/* unlinkat without AT_REMOVEDIR does not honor trailing / on Solaris 9.
+ Hurd has the same issue.
+
+ unlinkat without AT_REMOVEDIR erroneously ignores ".." on Darwin 14.
+
+ Solve these in a similar manner to unlink. */
int
rpl_unlinkat (int fd, char const *name, int flag)
}
}
if (!result)
- result = unlinkat (fd, name, flag);
+ {
+# if UNLINK_PARENT_BUG
+ if (len >= 2 && name[len - 1] == '.' && name[len - 2] == '.'
+ && (len == 2 || ISSLASH (name[len - 3])))
+ {
+ errno = EISDIR; /* could also use EPERM */
+ return -1;
+ }
+# endif
+ result = unlinkat (fd, name, flag);
+ }
return result;
}
;;
*)
# GNU/Hurd has unlinkat, but it has the same bug as unlink.
+ # Darwin has unlinkat, but it has the same UNLINK_PARENT_BUG.
if test $REPLACE_UNLINK = 1; then
REPLACE_UNLINKAT=1
fi