bug-gnulib
[Top][All Lists]
Advanced

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

sawewd problem


From: Bruno Haible
Subject: sawewd problem
Date: Tue, 2 Jan 2007 22:08:59 +0100
User-agent: KMail/1.9.1

Hi,

When I use the fchdir emulation on a Linux 2.4.x system (that doesn't have
openat() and similar), the coreutils-6.7 tests install/basic-1 and mkdir/p-3
fail. The reason is this part:

$ mkdir -p sub1/d
$ cd sub1/d
$ chmod a-rx ..
$ chmod a-r .
$ ginstall -d rel/a rel/b
ginstall: cannot create directory `rel': Permission denied

This error message appears once, for rel/a. For the second argument, rel/b,
the directory already exists and no error message is shown.

The system call log (from "strace -f") is attached. Can someone decipher it?
1) Why is the subprocess 2229 showing an error message as a result of
open(".", O_RDONLY|O_LARGEFILE) = -1 / EACCES ? Isn't the point of forking
precisely to be able to "restore" the working directory in situations like
this?
2) Why is the subdirectory rel/a not created, whereas rel/b is? The parent
process only propagates error codes, until a savewd_restore call; whereas the
child process does not even attempt to create the rel/a directory.

Bruno

============== strace -f /build/coreutils-6.7-fchdir/src/ginstall -d rel/a 
rel/b =============

2228  brk(0)                            = 0x80584b0
2228  brk(0x80794b0)                    = 0x80794b0
2228  brk(0x807a000)                    = 0x807a000
2228  geteuid32()                       = 101
2228  umask(0)                          = 022
2228  mkdir("rel", 0755)                = 0
2228  open("rel", 
O_RDONLY|O_NONBLOCK|O_NOCTTY|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 5
2228  fstat64(5, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
2228  getcwd("/build/coreutils-6.7-fchdir/tests/install/sub1/d", 4096) = 49
2228  lstat64("/build/coreutils-6.7-fchdir/tests/install/sub1/d/rel", 
0xbfffe218) = -1 EACCES (Permission denied)
2228  brk(0x8079000)                    = 0x8079000
2228  open(".", O_RDONLY|O_LARGEFILE)   = -1 EACCES (Permission denied)
2228  fork()                            = 2229
2228  close(5)                          = 0
2228  waitpid(2229,  <unfinished ...>
2229  --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
2229  close(5)                          = 0
2229  write(2, "/build/coreutils-6.7-fchdir/src/"..., 42) = 42
2229  write(2, "cannot create directory `rel\'", 29) = 29
2229  write(2, ": Permission denied", 19) = 19
2229  write(2, "\n", 1)                 = 1
2229  exit_group(1)                     = ?
2228  <... waitpid resumed> [WIFEXITED(s) && WEXITSTATUS(s) == 1], 0) = 2229
2228  --- SIGCHLD (Child exited) @ 0 (0) ---
2228  mkdir("rel", 0755)                = -1 EEXIST (File exists)
2228  chdir("rel")                      = 0
2228  mkdir("b", 0755)                  = 0
2228  open("b", 
O_RDONLY|O_NONBLOCK|O_NOCTTY|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 5
2228  fstat64(5, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
2228  getcwd("/build/coreutils-6.7-fchdir/tests/install/sub1/d/rel", 4096) = 53
2228  lstat64("/build/coreutils-6.7-fchdir/tests/install/sub1/d/rel/b", 
0xbfffe258) = -1 EACCES (Permission denied)
2228  fstat64(5, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
2228  close(5)                          = 0
2228  close(1)                          = 0
2228  close(2)                          = 0
2228  exit_group(1)                     = ?

Similarly with mkdir:
============= strace -f /build/coreutils-6.7-fchdir/src/mkdir -p rel/a rel/b 
================
2428  brk(0)                            = 0x804e784
2428  brk(0x806f784)                    = 0x806f784
2428  brk(0x8070000)                    = 0x8070000
2428  umask(0)                          = 022
2428  mkdir("rel", 0755)                = 0
2428  open("rel", 
O_RDONLY|O_NONBLOCK|O_NOCTTY|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 5
2428  fstat64(5, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
2428  getcwd("/build/coreutils-6.7-fchdir/tests/mkdir/sub1/d", 4096) = 47
2428  lstat64("/build/coreutils-6.7-fchdir/tests/mkdir/sub1/d/rel", 0xbfffe2a8) 
= -1 EACCES (Permission denied)
2428  brk(0x806f000)                    = 0x806f000
2428  open(".", O_RDONLY|O_LARGEFILE)   = -1 EACCES (Permission denied)
2428  fork()                            = 2429
2428  close(5)                          = 0
2428  waitpid(2429,  <unfinished ...>
2429  --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
2429  close(5)                          = 0
2429  write(2, "/build/coreutils-6.7-fchdir/src/"..., 39) = 39
2429  write(2, "cannot create directory `rel\'", 29) = 29
2429  write(2, ": Permission denied", 19) = 19
2429  write(2, "\n", 1)                 = 1
2429  exit_group(1)                     = ?
2428  <... waitpid resumed> [WIFEXITED(s) && WEXITSTATUS(s) == 1], 0) = 2429
2428  --- SIGCHLD (Child exited) @ 0 (0) ---
2428  mkdir("rel", 0755)                = -1 EEXIST (File exists)
2428  chdir("rel")                      = 0
2428  mkdir("b", 0755)                  = 0
2428  close(1)                          = 0
2428  close(2)                          = 0
2428  exit_group(1)                     = ?




reply via email to

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