Hi, with tar 1.26, it looks like test extrac13.at fails when the current OS has a defined O_NOFOLLOW (so not undefined and manually defined to 0 inside tar), but not working.
In particular, the case is tar on GNU/Hurd (see [1]); configure detects
that O_NOFOLLOW does not seem to work:
| checking for working fcntl.h... no (bad O_NOFOLLOW)
the failure happens at line 41 of extrac13.at ("tar --overwrite -xf
archive.tar ...."): the open() used for writing "dst2/file1" fails
because the file exist already, while it should have been removed
earlier (by the "maybe_recoverable" in "extract_file").
Attached there is my attempt in fixing the issue (of course there's also
the non-working O_NOFOLLOW on GNU/Hurd, but that's another issue),
making the fstatat() check in "open_output_file" be done even in case
O_NOFOLLOW is properly defined but detected as not working by the
configure check.
[1]
https://buildd.debian.org/status/fetch.php?pkg=tar&arch=hurd-i386&ver=1.26-4&stamp=1325314847
Thanks,
--
Pino Toscano
--- a/src/extract.c
+++ b/src/extract.c
@@ -879,7 +879,7 @@
/* If O_NOFOLLOW is needed but does not work, check for a symlink
separately. There's a race condition, but that cannot be avoided
on hosts lacking O_NOFOLLOW. */
- if (! O_NOFOLLOW && overwriting_old_files && ! dereference_option)
+ if ((! O_NOFOLLOW || ! HAVE_WORKING_O_NOFOLLOW) && overwriting_old_files && ! dereference_option)
{
struct stat st;
if (fstatat (chdir_fd, file_name, &st, AT_SYMLINK_NOFOLLOW) == 0
signature.asc
Description: This is a digitally signed message part.
