On 07/26/2012 03:33 AM, Jez Wain wrote:
> On the new server, which produced the erroneous result,
> fcntl.h defines both O_NOFOLLOW and AT_SYMLINK_NOFOLLOW

OK, thanks, but why do you later mention
_XOPEN_SOURCE?  Is that relevant?

It sounds like we need to add a test for this AIX bug,
and then put a workaround into tar.  Let's start with the
test.  Suppose you compile the following test program:

  #include <fcntl.h>

  int
  main (void)
  {
    int flags = O_NOFOLLOW | O_WRONLY | O_CREAT;
    mode_t perms = S_IRUSR | S_IWUSR;
    return openat (AT_FDCWD, "symlink", flags, perms) < 0 ? 0 : 1;
  }

Put this into a.out, and then run these shell commands:

   rm -f file symlink
   touch file
   ln -s file symlink
   truss ./a.out

What does the tail end of the "truss" output say,
starting with the first mention of "symlink"?
On a working system, openat should fail and the
program should exit with status 0.  My guess is
that on AIX openat succeeds, and the program exits
with status 1.

Reply via email to