Can the entry ".." become linked to someplace other than the parent directory? Is it possible to cause "tar" to create this weird behavior?

Scenario: I have a pre-built compiler to a embeded system, distributed as tar.gz files, which works perfectly in Ubuntu 10.04. When testing an upgrade to Ubuntu 12.04 in a VirtualBox VM, it failed to find out some header files. Exploring the files for the cause of the problem, I noticed it became lost following "/a/somewhat/convoluted/../../path/../full/of/up/../references/". Exploring a bit more, I found some strange behavior:

  • "ls /that/strange/../../path" shows me the files as expected.

  • typing "ls /that/strange/../../path" in bash for a list of files inside "/that/strange/../../path" (ie, triggering the filename completion without running "ls") shows me a DIFFERENT list of files.

  • when I fix the path interpreting the ".." by hand, both outputs are the same.

I suppose "ls" and the filename globbing differ in the way they find the files (opendir/readdir, glob, etc.) and one of these operations steps in a filesystem error. Running fsck in the VM resulted in nothing unusual. Same result for installing the compiler again in a new VM. "tar" returned no error. Do somebody got this kind of problem?

1 Answer 1


Is one of the "directories" in your path actually a symbolic link to some other directory? If so, then .. will go to the parent directory of the target directory, not to the directory containing the symbolic link.

Bash tries to "fix" this by reinterpreting .. to mean the directory containing the symlink. I'm sure there's a way to turn this annoying behavior off, though I don't have it handy as I can't remember the last time I personally had to deal with this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .