On Tue, Oct 23, 2012 at 8:09 PM, Ian Lance Taylor <i...@google.com> wrote:
> On Tue, Oct 23, 2012 at 10:47 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
>>
>> Additional test fails on alphaev68-linux-gnu:
>>
>> --- FAIL: TestPassFD (0.15 seconds)
>> passfd_test.go:62:      FileConn: dup: Bad file descriptor
>> FAIL
>> FAIL: syscall
>
> As far as I can see this error message occurs when calling dup on the
> second file descriptor returned by socketpair.  But I can't see why
> that would fail on Alpha.

For some reason, the second dup on the same file descriptor fails.
Attached, please find strace dump, where:

...
gettimeofday({1351064744, 381316}, NULL) = 0
gettimeofday({1351064744, 381316}, NULL) = 0
gettimeofday({1351064744, 382293}, NULL) = 0
gettimeofday({1351064744, 382293}, NULL) = 0
gettimeofday({1351064744, 382293}, NULL) = 0
dup(4)                                  = 9
osf_sigprocmask(SIG_BLOCK, [])          = 0 (old mask [])
mmap(NULL, 24704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x20003076000
mprotect(0x20003076000, 8192, PROT_NONE) = 0
clone(child_stack=0x2000307ab70,
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,
parent_tidptr=0x2000307b350, tls=0x2000307b970,
child_tidptr=0x2000307b350) = 21544
fcntl(9, F_SETFD, FD_CLOEXEC)           = 0
osf_sigprocmask(SIG_BLOCK, [])          = 0 (old mask [])
sigreturn() (mask [SYS STOP TSTP IO USR2]) = 0
mmap(NULL, 24704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x2000307e000
mprotect(0x2000307e000, 8192, PROT_NONE) = 0
clone(child_stack=0x20003082b70,
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,
parent_tidptr=0x20003083350, tls=0x20003083970,
child_tidptr=0x20003083350) = 21545
futex(0x20000c4a450, FUTEX_WAIT, 0, NULL) = 0
sigreturn() (mask [ILL ABRT FPE KILL BUS ALRM URG CONT IO XCPU]) = 0
osf_sigprocmask(SIG_BLOCK, [])          = 0 (old mask [])
futex(0xf84042b248, FUTEX_WAKE, 1)      = 1
wait4(21546, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, {ru_utime={0,
51757}, ru_stime={0, 21484}, ...}) = 21546
osf_sigprocmask(SIG_BLOCK, [])          = 0 (old mask [])
close(9)                                = 0
dup(4)                                  = -1 EBADF (Bad file descriptor)
open("./a.out", O_RDONLY|O_CLOEXEC)     = 3
...

Is it OK to call dup on the same FD the second time?

Uros.

Reply via email to