in reply to Re^2: Why Perl misses installed modules ?
in thread Why Perl misses installed modules ?

Ah, the mysteries of unix file permissions ;-). Check out the chmod lines in my previous answer. I used a+r for the file, but a+rx for the directories.

For a directory the flags r and x have different meaning than for files. The r-flag allows access to files in the directory (if you already know the name). The x-flag allows you to read or search the directory. So except for special cases you normally want both flags either on or off

In your case both Games and Zork need another x.

  • Comment on Re^3: Why Perl misses installed modules ?

Replies are listed 'Best First'.
Re^4: Why Perl misses installed modules ?
by ikegami (Patriarch) on Sep 26, 2008 at 04:32 UTC

    You have it backwards.

    The x-flag allows access to files in the directory, which is why you need it at a minimum.
    The r-flag allows you to read the directory.

      I'm sure I'm right with this. This was the way on Solaris and when I use 'man 2 chmod' on linux, I find the following sentence (translated from german):

      S_IXOTH 00001 Execute rights for others, on directories: others + are allowed to search directory

      I also used this effect a few times to make dirs unreadable, but allowed the files in it to be read (security by obscurity, but better than nothing).

      UPDATE: Sure I was, but wrong. As wrong as the man page.

        I'm afraid ikegami is right on this one. For me, the magic of modes is one of the most confusing areas in *nix.

        jth@reina:~/tmp/t$ ls -l total 8 dr--r--r-- 2 jth jth 4096 2008-09-26 06:42 r d--x--x--x 2 jth jth 4096 2008-09-26 06:42 x jth@reina:~/tmp/t$ ls r ls: cannot access r/file: Permission denied file jth@reina:~/tmp/t$ ls x ls: cannot open directory x: Permission denied jth@reina:~/tmp/t$ cat r/file cat: r/file: Permission denied jth@reina:~/tmp/t$ cat x/file contents of x/file

        As you can see, r lets me list the file with ls (read the directory) but not access the file while x lets me access the file ("search") but not list the directory.

        Don't feel too bad, I've been messing with modes for about 15 years and I still had to test to see who was right. Besides, you are completely correct when you say that one would almost always want rx on a directory.

        I tested my claims on a linux system before posting. Maybe it's different on Solaris? (wow if true!) But it's more likely that "search" is a very poorly chosen name, because "r" is "read" for both files and directories. Linux refers to "x" on directories as "access".