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

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.

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

Replies are listed 'Best First'.
Re^5: Why Perl misses installed modules ?
by jethro (Monsignor) on Sep 26, 2008 at 10:43 UTC

    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".