[317] in athena10
Re: /svn/athena r23064 - trunk/debathena/scripts
daemon@ATHENA.MIT.EDU (Greg Hudson)
Sun Jul 13 00:20:46 2008
From: Greg Hudson <ghudson@MIT.EDU>
To: Jonathan Reed <jdreed@mit.edu>
Cc: Timothy G Abbott <tabbott@mit.edu>, athena10@mit.edu
In-Reply-To: <8D25C81B-1948-457C-B51E-9B889CCBAECD@mit.edu>
Content-Type: text/plain
Date: Sun, 13 Jul 2008 00:20:00 -0400
Message-Id: <1215922800.18347.266.camel@error-messages.mit.edu>
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
Generally it's best to avoid readability or writability checks; it's
better to just try stuff and handle the errors, since permissions can
change between when you check and when you do stuff anyway. By that
principle, it can be argued that File::Temp shouldn't be checking the
writability of the parent directory in the first place. But that's
likely to be a hard sell at this point.
File::Temp is performing the check with perl's -w operator. So, given
that the check is being performed at all, it's being done in a proper
way.
perl's -w operator should ideally be using the eaccess() API. (Which
would ideally be a system call; in practice, it uses access() for a
non-setuid program which should do the right thing.) perl's source code
has a configure check for eaccess() which appears to turn up positive
when I do a build of the Ubuntu source package, but when I do a system
call trace on perl -e '(-w "/");' I see it calling stat64() rather than
access(). That is probably a bug, but I don't want to devote additional
time to the matter right now.
On Sat, 2008-07-12 at 23:18 -0400, Jonathan Reed wrote:
> On Jul 12, 2008, at 10:41 PM, Timothy G Abbott wrote:
>
> > It possible that this is worth reporting as a bug in perl's Tempfile
> > (in theory, it should be using the access system call, not doing its
> > own check).
>
> I thought Perl always did its own check? I have long had to include
> "use filetest 'access';" when using file test operators in Perl on any
> files in AFS. Or were you saying that in this particular case
> (tempfile) it should be using access()?
>
> -Jon