bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] [GNU tar 1.26] testsuite: 39 failed


From: Jez Wain
Subject: Re: [Bug-tar] [GNU tar 1.26] testsuite: 39 failed
Date: Fri, 27 Jul 2012 11:03:16 +0200

Paul you guessed correctly:

bash-4.2# touch file
bash-4.2# ln -s file symlink
bash-4.2# ./symlink-test 
bash-4.2# echo $?
1
bash-4.2# truss ./symlink-test
execve("./symlink-test", 0x2FF22CD4, 0x20013588)  argc: 1
kopenxat(-2, "symlink", O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR, 0) = 3
kfcntl(1, F_GETFL, 0x2FF22FFC)                  = 2
kfcntl(2, F_GETFL, 0x2FF22FFC)                  = 2
_exit(1)
bash-4.2# 


On 26 Jul 2012, at 18:27, Paul Eggert wrote:

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?


 _XOPEN_SOURCE is only relevant in that the O_NOFOLLOW definition depends on _XOPEN_SOURCE as being defined as > 700:

bash-4.2# grep -p O_NOFOLLOW /usr/include/fcntl.h 
#if _XOPEN_SOURCE >= 700
#define O_CLOEXEC       _FCLOEXEC       /* sets FD_CLOEXEC on open      */
#define O_NOFOLLOW      _FNOFOLLOW      /* do not follow symlinks       */
#define O_TTY_INIT      _FTTYINIT       /* sets conforming tty state    */
#endif /* _XOPEN_SOURCE >= 700 */

Recall that the O_NOFOLLOW has been introduced only in the latest version of AIX.  Early versions of AIXv7, 6, 5, and 4 don't have this definition. 

Jez


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

[Prev in Thread] Current Thread [Next in Thread]