On Wed, Aug 31, 2011 at 19:35, Kevin Brott <kevin.br...@gmail.com> wrote:
> 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. > > $ dd if=/dev/urandom of=$PWD/random-file-10 bs=1024 count=10 $ dd if=/dev/urandom of=$PWD/random-file-100 bs=1024 count=100 $ ls -l -rw-r--r-- 1 xxxxxx xxxxxxxx 10240 Aug 31 20:09 random-file-10 -rw-r--r-- 1 xxxxxx xxxxxxxx 102400 Aug 31 20:09 random-file-100 -rwxr-xr-x 1 xxxxxx xxxxxxxx 1778388 Aug 31 20:06 tar-fstatat -rwxr-xr-x 1 xxxxxx xxxxxxxx 1779667 Aug 30 12:53 tar-nofstatat $ truss -f ./tar-fstatat -cf test-fstatat.tar random* > fstatat.truss 2>&1 $ truss -f ./tar-nofstatat -cf test-nofstatat.tar random* > nofstatat.truss 2>&1 $ ls -l -rw-r--r-- 1 xxxxxx xxxxxxxx 14715 Aug 31 20:14 fstatat.truss -rw-r--r-- 1 xxxxxx xxxxxxxx 16725 Aug 31 20:14 nofstatat.truss -rw-r--r-- 1 xxxxxx xxxxxxxx 10240 Aug 31 20:09 random-file-10 -rw-r--r-- 1 xxxxxx xxxxxxxx 102400 Aug 31 20:09 random-file-100 -rwxr-xr-x 1 xxxxxx xxxxxxxx 1778388 Aug 31 20:06 tar-fstatat -rwxr-xr-x 1 xxxxxx xxxxxxxx 1779667 Aug 30 12:53 tar-nofstatat -rw-r--r-- 1 xxxxxx xxxxxxxx 10240 Aug 31 20:14 test-fstatat.tar -rw-r--r-- 1 xxxxxx xxxxxxxx 122880 Aug 31 20:14 test-nofstatat.tar $ tar tvf test-fstatat.tar -rw-r--r-- xxx xxx 0 Aug 31 20:09:57 2011 random-file-10 -rw-r--r-- xxx xxx 0 Aug 31 20:09:39 2011 random-file-100 $ tar tvf test-nofstatat.tar -rw-r--r-- xxx xxx 10240 Aug 31 20:09:57 2011 random-file-10 -rw-r--r-- xxx xxx 102400 Aug 31 20:09:39 2011 random-file-100 Attached are the full truss outputs. It *looks* like a lot of extra/failed seeks in the fstatat-enabled tar? -- # include <stddisclaimer.h> /* Kevin Brott <kevin.br...@gmail.com> */
fstatat.truss.gz
Description: GNU Zip compressed data
nofstatat.truss.gz
Description: GNU Zip compressed data