I think, this will better show what you wanted to say to all:

dev% umask
0777
dev% touch foo
dev% perl -MFile::Temp -le '$File::Temp::KEEP_ALL=1;
File::Temp->new(DIR => ".");'
dev% ls -l
total 0K
---------- 1 cub cub 0 2011-09-09 01:04 foo
-rw------- 1 cub cub 0 2011-09-09 01:04 RSdAy0ZtMR

So, when you told that File::Temp don't honor umask, and sets
permissions explicitly, you was correct - this is really so. Looking
at sources confirms that File::Temp use explicit "chmod 0600". And
perldoc for chmod don't tell anything about umask. Seems, Perl is not
very obvious here. Moreover:

dev% umask
0777
dev% perl -e 'print umask'
511
dev% umask 0002
dev% perl -e 'print umask'
2

Not sure why this is so. This seems to be interesting and need to be
investigated additionally. At least, perldoc don't made me clear about
why chmod and umask works in such way in Perl.

But let's return to File::Temp. As I said - yes, it change permissions
to be 0600. Why you consider this as bug? This is just reasonable and
secure behavior, not more. As for me, it's obviously: if user create
new temporary file - then this file will be empty. Nobody interested
in empty files :), and so something will be written to it earlier or
later. And there is no reason to only write (to temporary file!) and
then never read back. And so, it's obvious that user should have "rw"
access - nor only "r", nor only "w". And for security reasons, nobody
else should have access to personal temporary files. As for me, all
this looks very logical, isn't?

But from start of this thread you didn't tell yet, why all this is
problem for you? Nobody cares about temp files, and everywhere
everything works fine, but not for you. So, why?



2011/9/8 Todd Wade <tr...@sbcglobal.net>:
>
>
>
>
> From: Dave Howorth <dhowo...@mrc-lmb.cam.ac.uk>
>> Apps don't 'honour' umasks; the kernel applies them to whatever
>> permissions apps ask for.
>
> $ umask
> 0002
> $ touch foo
> $ perl -MFile::Temp -le '$File::Temp::KEEP_ALL=1; File::Temp->new(DIR => 
> ".");'
> $ ls -l
> -rw-rw-r--  1 me  me  0 Sep  8 13:54 foo
> -rw-------  1 me  me  0 Sep  8 13:55 j3DftrlDiM
>
> touch honors the umask, File::Temp sets the mode of the file explicitly.
>
> Please, continue to use different words to say the same thing I am while 
> calling
> me wrong and you right. I'm curious as to how long you'll go.
>
> Todd W.
>
> _______________________________________________
> templates mailing list
> templates@template-toolkit.org
> http://mail.template-toolkit.org/mailman/listinfo/templates
>



-- 
Sincerely yours,
Oleg Kostyuk (CUB-UANIC)

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to