[#8815] Segfault in libc strlen, via rb_str_new2 — "Sean E. Russell" <ser@...>

Howdy,

12 messages 2006/09/09
[#8817] Re: Segfault in libc strlen, via rb_str_new2 — Eric Hodel <drbrain@...7.net> 2006/09/09

On Sep 8, 2006, at 10:10 PM, Sean E. Russell wrote:

[ ruby-Bugs-5884 ] Dir.chroot and '/'

From: <noreply@...>
Date: 2006-09-25 01:54:40 UTC
List: ruby-core #8913
Bugs item #5884, was opened at 2006-09-24 18:54
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=5884&group_id=426

Category: Core
Group: 1.8.x
Status: Open
Resolution: None
Priority: 3
Submitted By: Daniel Berger (djberg96)
Assigned to: Nobody (None)
Summary: Dir.chroot and '/'

Initial Comment:
Hi all,

Ruby 1.8.4 and 1.8.5.
Suse Linux 10.1, though I imagine this happens on all *nix platforms.

It appears that the internal function check_dirname in dir.c is converting '/' into an empty string when you try to do Dir.chroot('/').

# As root...

irb(main):001:0> Dir.chroot(Dir.pwd)
=> 0
irb(main):002:0> Dir.chroot('/')
Errno::ENOENT: No such file or directory -
        from (irb):2:in `chroot'
        from (irb):2

I don't particularly understand why we need the check_dirname() call there at all, except perhaps for the rb_secure() call.

Regards,

Dan

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=5884&group_id=426

In This Thread

Prev Next