Mac and Perl - permissions on Volume not reliable

D

Dan

Dear All,

Not sure if this is a perl or mac issue, or a bit of both...

Here's a tricky problem in some simple Perl code...

$store = '/Volumes/Store Server/store/';
opendir(STORE, $store) or die $!;
@FILES=readdir STORE;
closedir(STORE);
print $#FILES;

This code is executed on a machine running Apache under OS X Tiger
(client) that is connected with AFP to a server running OS X.3 Server.

In my web browser i open the script, and it dies with the following
error...

Permission denied at /Library/WebServer/CGI-Executables/yada/yada.pl
line 54.

When I refresh, the error appears again. Refresh another time and the
script works, providing the number of files in the directory.

Hit refresh again and the error comes back! The next few refreshes
produce randomly either the error message or the correct answer.
Nothing is changing... nobody else is using the server, the script
isn't being changed. What on earth is going on? Is this a permissions
hole in OSX? I've tried opening the permissions of of /store/ to 777,
but it makes no difference.

Any advise my guru betters?

Thanks,

Dan
 
A

Anno Siegel

Dan said:
Dear All,

Not sure if this is a perl or mac issue, or a bit of both...

Here's a tricky problem in some simple Perl code...

$store = '/Volumes/Store Server/store/';
opendir(STORE, $store) or die $!;
@FILES=readdir STORE;
closedir(STORE);
print $#FILES;

[opendir() fails and succeeds apparently at random]

The problem is most likely not with the Perl code but with the conditions
when it is run.
This code is executed on a machine running Apache under OS X Tiger
(client) that is connected with AFP to a server running OS X.3 Server.

Are all httpd instances running under the same userid? Is automounting
involved?

Add more info to the error message. The pid of the serving httpd might
be a clue. User- and or group id might be another.

Anno
 
D

Dan

Anno said:
[opendir() fails and succeeds apparently at random]

The problem is most likely not with the Perl code but with the conditions
when it is run.
This code is executed on a machine running Apache under OS X Tiger
(client) that is connected with AFP to a server running OS X.3 Server.

Are all httpd instances running under the same userid? Is automounting
involved?

Add more info to the error message. The pid of the serving httpd might
be a clue. User- and or group id might be another.

How would I find this information?

Thanks,

Dan
 
A

A. Sinan Unur

Anno said:
[opendir() fails and succeeds apparently at random]
....
Add more info to the error message. The pid of the serving httpd
might be a clue. User- and or group id might be another.

How would I find this information?

perldoc perlvar

--
A. Sinan Unur <[email protected]>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
 
A

Anno Siegel

Dan said:
Anno said:
[opendir() fails and succeeds apparently at random]

The problem is most likely not with the Perl code but with the conditions
when it is run.
This code is executed on a machine running Apache under OS X Tiger
(client) that is connected with AFP to a server running OS X.3 Server.

Are all httpd instances running under the same userid? Is automounting
involved?

Add more info to the error message. The pid of the serving httpd might
be a clue. User- and or group id might be another.

How would I find this information?

The httpd pid is probably an environment variable set by apache. User-
and group id (effective and real) are in $>, $<, $(, and $) iirc.
Perldoc perlvar.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top