Do I recall you saying that you'd hacked ruby to get it's executable
location? I'd like to see that hack, I'm pretty confident I can think up
a number of cases where it wouldn't work.
I posted it - look back in the thread... I used the /proc/self/exe symbolic link. I only care about Linux and Windows support, so between the two the existing windows code and my readlink hack took care of it.
…and it wouldn’t be under Windows? Sorry, I don’t buy it.
Where I’ve said that it’s not a security problem under Windows ?
My point being that it works differently under Windows and it is
considered acceptable there, whereas under *nix it works completely
differently for no (IMO) particularly good reason.
Are you saying you prefer it only support hard-coded paths on all of its
platforms? I don’t see Ruby as a ‘system’ service.
I should be able to have multiple copies (w/ different versions) loaded
wherever I want and know where it will get its modules (in
subdirectories off of the Ruby binary).
Executables in unix don’t have a knowledge of “where they are”. They
don’t, in fact, have to “be” anywhere. Some are even built into the boot
image, so don’t in fact have to have ever “been” anywhere.
Well, on some operating systems it’s certainly possible to find the
executable image corresponding to a process (eg: Linux) and on others
Even if its been unlinked? How would one do this, exactly, read it from
/proc? It would be a handy trick to know.
you can find the device number / inode no. of each text section within
the process.
That’s pretty cool, I didn’t know that.
But a (device#,inode#) pair isn’t a path, and can be reachable through 0
(if unlinked), 1, or more (if links are present) paths, and wouldn’t it
be a fairly time consuming process, searching from /, to try and find a
path that points to that dev/inod pair?.
Its not only about security, its also about predictability. Even if you
could find a path, when I choose which of the rubys in my system to use
by putting a symlink to the correct version in my ~/bin directory,
wouldn’t that mean that ruby wouldn’t run, when it found that ~/lib/ruby
didn’t exist?
Maybe its a really great idea, but my point is that its not just unix
people being stuck in their ways (though we notoriously are :-), it is
not obvious how/whether this could be implemented on a unix box.