Files only visible from their directory

0

I'm running a build command that refers to library files three directories up using the -I option. The path to the directory from which I'm calling GCC is /home/user/a/b/c/d/a1/a2/test while the libraries are in /home/user/a/b/c/d.

However, the strange thing is that I'm unable to access or even see the files unless I cd to their folder. If I run ls ../../../ from the test folder, then those files do not appear at all. They are actual files and not symbolic links. I've even run chmod o+x on them to be sure.

Anyone know what's going on?

Danny

Posted 2018-04-27T03:44:58.213

Reputation: 227

Please provide the output of namei -l /home/user/a/b/c/d/a1/a2/test and namei -l /home/user/a/b/c/d/somelibraryname.h. – user1686 – 2018-04-27T04:54:26.660

The first command lists the folder names up to the directory in question. The second command shows the same output, except it recognizes the library file. – Danny – 2018-04-28T06:06:50.823

Answers

0

I've finally found the cause of the problem. It turns out one of the directories was actually a symbolic link to another directory. So ls was acting on the target directory and not the directory containing the symbolic link. Using the absolute path resolved the issue.

Danny

Posted 2018-04-27T03:44:58.213

Reputation: 227