test 56:
--- -
+++ /home/salinger/tar-1.26/tests/testsuite.dir/at-groups/56/stderr

@@ -1,2 +1,5 @@
+tar: Cannot get working directory: Permission denied
 tar: a: Directory is new
+tar: Cannot get working directory: Permission denied
+tar: Cannot get working directory: Permission denied  

56. listed03.at:22: 56. incremental dump when the parent directory is
unreadable (listed03.at:22): FAILED (listed03.at:25)

The tar tries to use getcwd, but in the pathname the parent dir is unreadable.


According to
http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html

  If a program is operating in a directory where some (grand)parent
  directory does not permit reading, getcwd() may fail, as in most
  implementations it must read the directory to determine the name of the
  file.

The implementation of getcwd under GNU/kFreeBSD uses a kernel cache,
and eventually tries to get it by traversing.
Usually kernel cache succeeds in natively mounted dirs,
and fails in bind/nullfs mounted dir.

strace under Linux:

openat(AT_FDCWD, "a", 
O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC) = 5
fstat(5, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
newfstatat(5, "file", {st_mode=S_IFREG|0644, st_size=4, ...},
AT_SYMLINK_NOFOLLOW) = 0
openat(5, "file", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_NOFOLLOW|O_CLOEXEC) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=4, ...}) = 0
write(1, "a/file\n", 7)                 = 7
read(6, "bla\n", 4)                     = 4
fstat(6, {st_mode=S_IFREG|0644, st_size=4, ...}) = 0
close(6)                                = 0
getcwd("/home/petrsa/trash/tar-1.26/dir/sub", 4096) = 36

ktrace under GNU/kFreeBSD:

 60863 tar      CALL  fstatat(0xffffff9c,0x64c2d0,0x7fffffffe180,0x200)
 60863 tar      NAMI  "a"
 60863 tar      STRU  invalid record
 60863 tar      RET   fstatat 0
 60863 tar      CALL  openat(0xffffff9c,0x64c2d0,0x8104,0)
 60863 tar      NAMI  "a"
 60863 tar      RET   openat 5
 60863 tar      CALL  fstat(0x5,0x7fffffffe1d0)
 60863 tar      STRU  invalid record
 60863 tar      RET   fstat 0
 60863 tar      CALL  fstat(0x5,0x7fffffffdd60)
 60863 tar      STRU  invalid record
 60863 tar      RET   fstat 0
 60863 tar      CALL  fcntl(0x5,<invalid=3>,0)
 60863 tar      RET   fcntl 4
 60863 tar      CALL  fcntl(0x5,<invalid=2>,FD_CLOEXEC)
 60863 tar      RET   fcntl 0
 60863 tar      CALL  getdents(0x5,0x651180,0x8000)
 60863 tar      RET   getdents 512/0x200
 60863 tar      CALL  getdents(0x5,0x651180,0x8000)
 60863 tar      RET   getdents 0
 60863 tar      CALL  __getcwd(0x7fffffffd440,0x400)
 60863 tar      NAMI  ".."
 60863 tar      RET   __getcwd -1 errno 13 Permission denied
..
 60863 tar      CALL  open(0x800b99e7e,O_NONBLOCK,<unused>0)
 60863 tar      NAMI  ".."
 60863 tar      RET   open -1 errno 13 Permission denied
 60863 tar      CALL  write(0x2,0x7fffffffb3f0,0x7)
 60863 tar      GIO   fd 2 wrote 7 bytes
       "./tar: "
 60863 tar      RET   write 7
 60863 tar      CALL  write(0x2,0x7fffffffb470,0x1c)
 60863 tar      GIO   fd 2 wrote 28 bytes
       "Cannot get working directory"
 60863 tar      RET   write 28/0x1c
 60863 tar      CALL  write(0x2,0x7fffffffaf60,0x13)
 60863 tar      GIO   fd 2 wrote 19 bytes
       ": Permission denied"


Back-trace up-to getcwd()

#3  0x00000000004180fa in normalize_filename (name=0x64c600 "a") at misc.c:298
#4  0x00000000004129d6 in attach_directory (name=<value optimized out>, 
mtime=..., dev=184614661, ino=17522742, nfs=false, found=false, 
contents=0x64c610 "Yfile") at incremen.c:282
#5  note_directory (name=<value optimized out>, mtime=..., dev=184614661, 
ino=17522742, nfs=false, found=false, contents=0x64c610 "Yfile") at 
incremen.c:312
#6  0x0000000000414b4e in read_incr_db_2 () at incremen.c:1262
#7  read_directory_file () at incremen.c:1338
#8  0x000000000041a33c in collect_and_sort_names () at names.c:959
#9  0x000000000040ca22 in create_archive () at create.c:1321
#10 0x0000000000404925 in main (argc=<value optimized out>, argv=<value 
optimized out>) at tar.c:2646



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to