IO#reopen bug in 1.8.4?


#1

Greetings list,

$stdout.fileno => 1
$stderr.fileno => 2
$stderr.reopen($stdout)
$stderr.fileno => 2

Shouldn’t that last line evaluate to 1?

BTW, it does indeed redirect STDERR to STDOUT, it’s just that the
#fileno
appears to be wrong.


#2

On Wed, 8 Feb 2006, Jason C. wrote:

appears to be wrong.
i think it’s ok

 harp:~ > strace ruby -e'  STDERR.reopen STDOUT  ' 2>&1| tail
 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
 geteuid32()                             = 447
 getegid32()                             = 447
 getuid32()                              = 447
 geteuid32()                             = 447
 getgid32()                              = 447
 getegid32()                             = 447
 dup2(1, 2)                              = 2
 rt_sigaction(SIGINT, {SIG_DFL}, {0x80a1ff4, [], 

SA_RESTORER|SA_RESTART, 0x3710d8}, 8) = 0
exit_group(0) = ?

so all that’s happening is a dup2. in that case there should in fact be
two
fds (fileno).

regards.

-a