M
Matthew Denner
Hi,
Why is it that Dir.glob("*/b") will follow a symlinked directory but
Dir.glob("**/b") will not?
I have read http://groups.google.com/group/comp...ed512?lnk=st&q=&rnum=1&hl=en#e9bc0579939ed512
in which the reply says:
"**" doesn't traverse symbolic links, or it can cause an infinite loop.
Ok, sure, someone could do:
mkdir a/b
ln -s ../../a a/b/c
So as to create a symlink from 'a/b/c' back to 'a' which would cause
infinite recursion, but then this is their own stupid fault IMO! I
really don't see that this is a justifiable reason for this and, if it
is, then why isn't there a flag that can be passed that'll allow
people to say "follow symlinks for **".
The reason I ask this is because I do alot of my development
(Ruby-on-Rails) offline so use SVK (http://svk.elixus.org/) which
doesn't support the 'svn:externals' property. Because of this I make
symlinks from my 'vendor/plugins' directory to other SVK checked out
directories. All this works (I think) fine when running the
application but doesn't add things like generators provided by plugins
like Rails Engines. This is because the code looking for the
generator uses Dir['vendor/plugin/**/generators'].
Now, it could be argued that this is a problem for Rails to do (to
standardise the locations of these generators) but I personally want
to understand whether this decision not to follow symlinks is purely
because of my contrived example above.
Matt
Why is it that Dir.glob("*/b") will follow a symlinked directory but
Dir.glob("**/b") will not?
I have read http://groups.google.com/group/comp...ed512?lnk=st&q=&rnum=1&hl=en#e9bc0579939ed512
in which the reply says:
"**" doesn't traverse symbolic links, or it can cause an infinite loop.
Ok, sure, someone could do:
mkdir a/b
ln -s ../../a a/b/c
So as to create a symlink from 'a/b/c' back to 'a' which would cause
infinite recursion, but then this is their own stupid fault IMO! I
really don't see that this is a justifiable reason for this and, if it
is, then why isn't there a flag that can be passed that'll allow
people to say "follow symlinks for **".
The reason I ask this is because I do alot of my development
(Ruby-on-Rails) offline so use SVK (http://svk.elixus.org/) which
doesn't support the 'svn:externals' property. Because of this I make
symlinks from my 'vendor/plugins' directory to other SVK checked out
directories. All this works (I think) fine when running the
application but doesn't add things like generators provided by plugins
like Rails Engines. This is because the code looking for the
generator uses Dir['vendor/plugin/**/generators'].
Now, it could be argued that this is a problem for Rails to do (to
standardise the locations of these generators) but I personally want
to understand whether this decision not to follow symlinks is purely
because of my contrived example above.
Matt