Skip Menu |
 

This queue is for tickets about the File-Slurp CPAN distribution.

Report information
The Basics
Id: 129029
Status: resolved
Priority: 0/
Queue: File-Slurp

People
Owner: cwhitener [...] gmail.com
Requestors: user42_kevin [...] yahoo.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: atomic tempfile() without OPEN
Date: Fri, 05 Apr 2019 16:39:07 +1100
To: bug-File-Slurp [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
Download (untitled) / with headers
text/plain 650b
With File::Slurp 9999.26 and File::Temp 0.2304, a program use File::Slurp; write_file('/tmp/foo', {atomic => 1}, "hello"); run with "perl -w foo.pl" prints a warning tempfile(): temporary filename requested but not opened. Possibly unsafe, consider using tempfile() with OPEN set to true This is from File::Temp. It's one of those blast every user messages, but it's correct that an opened temp file avoids risks of clashes or races (small risks). If I'm not mistaken, write_file() wants an opened temp at that point, if felt like letting tempfile() do it. I think a chmod() would be needed to copy perms of the actual target.
Download (untitled) / with headers
text/plain 516b
Hi Kevin, I understand your concern and I have patched the documentation that's no longer correct. The switch from the pid method to File::Temp was done to prevent overwriting files that could already exist on the system; File::Temp fixes this. https://github.com/perhunter/slurp/commit/911e214c9d4b777878a24257b8d825e71358a4a9 Let me look into what options we have to work around the -w flag and get back to you. If you can use warnings instead of using the -w flag, you won't be bothered by that. Thanks, Chase
Download (untitled) / with headers
text/plain 390b
Hi Kevin, I just cut a release to CPAN, 9999.27 that mitigates the problem of the warnings you were getting with the -w flag. As soon as that release hits all of the mirrors, you should be able to run your app with or without the -w flag with no problem. Thank you for pointing out the problem and if you notice anything in the future, please don't hesitate to let us know. Thanks, Chase
Subject: Re: [rt.cpan.org #129029] atomic tempfile() without OPEN
Date: Sat, 06 Apr 2019 18:25:52 +1100
To: "Chase Whitener via RT" <bug-File-Slurp [...] rt.cpan.org>
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
Download (untitled) / with headers
text/plain 623b
"Chase Whitener via RT" <bug-File-Slurp@rt.cpan.org> writes: Show quoted text
> > I just cut a release to CPAN, 9999.27 that mitigates the problem of > the warnings you were getting with the -w flag.
Ah yeah, beaut. I'm normally against its type of warnings, but you did note though that in this case it's reporting a real problem, in that two programs might get the same filename. The chance is extremely small, and the time period will be very small, but personally I'd be tempted to let tempfile() do it's OPEN for certainty, assuming its modes or layers work or can be made to work in desired way etc etc ... -- No, eees hamster.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.