Re: Old Mac OS X

On Thu, 2005-03-17 at 01:40 -0500, Donny Viszneki wrote:
> Who remembers this one?
> http://lists.w3.org/Archives/Public/www-validator/2005Jan/0036.html
> 
> Well someone asked me if I ever got it to work, and my answer was no. 
> But I looked at it again, and had a hunch, and I have identified the 
> problem. My validator now works perfectly with a hack in place, so I 
> will reveal the problem to this mailing list so that you can come up 
> with a more permanent solution:
> 
>     # Temporary filehandles.
>     my $spin  = IO::File->new_tmpfile;
>     my $spout = IO::File->new_tmpfile;
>     my $sperr = IO::File->new_tmpfile;
> 
> On Mac OS X, IO::File->new_tmpfile() tries to create a file in /tmp. 
> /tmp is owned by the administrator, and grouped under staff. The 
> permissions set /tmp only writable to the owner. The www user owns the 
> apache httpd threads that the main thread spawns. It didn't seem like a 
> good long term solution to change the permissions or the ownership of 
> /tmp, but when I temporarily did, the validator worked fine.\
> 
> So, if there is a separate function you can use to create these pipes, 
> then the problem will be solved. Please let me know what you think.

Hm, the suggestion in my reply at
http://lists.w3.org/Archives/Public/www-validator/2005Jan/0054.html
could be improved a bit now that we know /tmp permissions are the
problem.  tempfile() from File::Temp can be told to create temporary
files in a specified directory, or it can take the TMPDIR environment
variable into account (according to the manual page, on some platforms).

I think this would work for you... ie. take the suggestion from my
previous reply, but use something like:

    my $validator_tmpdir = "/some/where";
    my $spin  = tempfile(DIR => $validator_tmpdir);
    my $spout = tempfile(DIR => $validator_tmpdir);
    my $sperr = tempfile(DIR => $validator_tmpdir);

Of course, make sure that the /some/where dir exists and is writable by
the httpd user running the validator (and preferably as few as possible
others).

We may want to switch to File::Temp anyway in future validator versions
(if temp files are still needed, that is), as it seems to be more
flexible and paranoid than IO::File->new_tmpfile.

Received on Friday, 18 March 2005 22:08:28 UTC