[TriLUG] Bash Symbolic Link Traversal Question

Jack Hill jackhill at jackhill.us
Thu Jul 5 11:56:04 EDT 2012


On Thu, 05 Jul 2012 11:44:07 -0400
Ken Mink <ken.mink at gmail.com> wrote:

> Hey Folks,
>     I've been doing a lot of googling on this problem and can't seem
> to find a bash setting to make me happy. I do the following:
> mkdir /tmp/dir1
> mkdir /tmp/dir2
> echo "Testing 1 2 3" > /tmp/dir1/test
> ln -s /tmp/dir2 /tmp/dir1/dir2
> cd /tmp/dir1/dir2
> cat ../test
> 
> I'm running Ubuntu 12.04 and using bash and I get "cat: ../test: No
> such file or directory". Tab completion found 'test', but cat did
> not. cat looked in /tmp since it's the parent directory of the real
> dir2 not in /tmp/dir1 which is the parent directory of the symbolic
> link dir2 that I traversed.
> 
> I swear this has worked in the past. Does anyone know if it's
> possible to make this work?
> 
> Thanks,
> Ken

This doesn’t answer your question specifically, but it did remind me of
an article I read by the Plan 9 people about the difficulty of such a
situation that I thought others would enjoy reading:
http://plan9.bell-labs.com/sys/doc/lexnames.pdf

Jack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.trilug.org/pipermail/trilug/attachments/20120705/9b1492af/attachment.pgp>


More information about the TriLUG mailing list