Paul,

You may have found the culprit.  I'd compiled tar on an earlier version of AIX 
without any problems.  

On receiving your mail I checked this older system and found that O_NOFOLLOW is 
not defined in any header.  In fcntl.h there is only AT_SYMLINK_NOFOLLOW.

On the new server, which produced the erroneous result,  fcntl.h defines both 
O_NOFOLLOW and AT_SYMLINK_NOFOLLOW

I added the following pre compiler code at the head of extract.c and ran: make 
extract.o

#ifdef _XOPEN_SOURCE
#warning Got _XOPEN_SOURCE
#if _XOPEN_SOURCE >= 700
#warning _XOPEN_SOURCE >= 700
#endif  // _OPEN_SOURCE >= 700
#endif  // _XOPEN_SOURCE


#ifdef O_NOFOLLOW
#warning Got  O_NOFOLLOW
#else
#warning No O_NOFOLLOW
#endif


#ifdef AT_SYMLINK_NOFOLLOW
#warning Got AT_SYMLINK_NOFOLLOW
#endif 




bash-4.2# make extract.o
  CC     extract.o
"extract.c", line 31.2: 1506-948 (W) #warning Got _XOPEN_SOURCE
"extract.c", line 33.2: 1506-948 (W) #warning _XOPEN_SOURCE >= 700
"extract.c", line 41.2: 1506-948 (W) #warning Got  O_NOFOLLOW
"extract.c", line 48.2: 1506-948 (W) #warning Got AT_SYMLINK_NOFOLLOW
bash-4.2# 

(I added the XOPEN_SOURCE tests as it is a condition for the definition of 
O_NOFOLLOW in fcntl.h)

This explains why the code you flagged is not called as the test is for (! 
O_NOFOLLOW) but O_NOFOLLOW is defined


Jez

On 26 Jul 2012, at 00:08, Paul Eggert wrote:

> On 07/25/2012 07:50 AM, Jez Wain wrote:
>> here's the truss…
> 
> Thanks.  It appears that the code commented
> "If O_NOFOLLOW is needed but does not work, check for a symlink
> separately." in extract.c is not effective, that is, fstatat is
> not being invoked there.  Can you see why this is so?
> Perhaps you can debug tar with GDB.  Or perhaps you can
> send the output of the command
> 
> grep -r O_NOFOLLOW /usr/include
> 
> as one possibility is that O_NOFOLLOW is defined to
> some nonzero value on AIX but does not in fact work.

Reply via email to