On Wed, Aug 31, 2011 at 17:34, Paul Eggert <egg...@cs.ucla.edu> wrote:
> On 08/31/11 07:06, Kevin Brott wrote: > > If we do not use fstatat then tar builds and passes almost all of the > checks (only the two sparse file ones fail). > > If we use fstatat, then almost all of the checks fail - because the > resulting binary is dropping zero-byte files into the archives, and doesn't > function. > > > > So either there is a bug or enough of a fundamental difference in the way > AIX 7.1's new fstatat call works, that it's not usable with the way the > existing GNU tar code is trying to use it. > > It semmed pretty clear there is a bug there. > Unfortunately, the test program does not seem to expose the bug. > > How about this test program instead? Please run it in a directory > where conftest.file has been created via "echo xxx >conftest.file". > > If this test program works on AIX 7.1, can you modify it in a minor > way so that it correctly exposes the AIX bug? There must be some > way to do it, since 'tar' is doing it. > > #include <fcntl.h> > #include <sys/stat.h> > > int > main (void) > { > struct stat a; > struct stat b; > int fd = open (".", O_RDONLY); > > if (fd < 0) > return 10; > if (fstatat (fd, "conftest.file", &a, > AT_SYMLINK_NOFOLLOW) > != 0) > return 1; > if (lstat ("conftest.file", &b) != 0) > return 2; > if (a.st_size != b.st_size) return 3; > if (a.st_dev != b.st_dev) return 4; > if (a.st_ino != b.st_ino) return 5; > if (a.st_mode != b.st_mode) return 6; > if (a.st_nlink != b.st_nlink) return 7; > if (a.st_uid != b.st_uid) return 8; > if (a.st_gid != b.st_gid) return 9; > /* Don't check time members, to avoid caching issues. */ > return 0; > } > $ echo xxx > conftest.file $ cat conftest.file xxx $ xlc -o test source.c $ ./test ; echo $? 0 $ truss -f ./test 12058888: execve("./test", 0x2FF22AA4, 0x200132A8) argc: 1 12058888: 16908635: kopen(".", O_RDONLY) = 3 12058888: 16908635: statxat(3, "conftest.file", 0x2FF22910, 76, 01) = 0 12058888: 16908635: statx("conftest.file", 0x2FF22988, 76, 01) = 0 12058888: 16908635: kfcntl(1, F_GETFL, 0x2FF22FFC) = 67110914 12058888: 16908635: kfcntl(2, F_GETFL, 0x2FF22FFC) = 67110914 12058888: 16908635: _exit(0) I'm going to rebuild the non-working version of tar and the mostly-working version and have them both create a two-file archive and truss both runs. Maybe someone less clueless than I will be able to see where the failure is. -- # include <stddisclaimer.h> /* Kevin Brott <kevin.br...@gmail.com> */