develooper Front page | perl.perl5.porters | Postings from March 2016

[perl #127663] Safety for -i option

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
March 6, 2016 13:58
Subject:
[perl #127663] Safety for -i option
Message ID:
rt-4.0.18-6109-1457272692-34.127663-15-0@perl.org
On Sun Mar 06 02:32:46 2016, jiangyy@outlook.com wrote:
> 
> 
> 
> Regards,
> Yanyan Jiang 蒋炎岩
> Institute of Computer Software,
> Dept. of Computer Science, Nanjing University
> 

From original report:
#####
Like sed, perl can be used with -i to change files in-place. However, our tool discovered that the saving procedure is not as safe as sed. The system call trace (from 5.22.1):

open("file.txt", O_RDONLY|O_LARGEFILE) = 3
_llseek(3, 0, [0], SEEK_CUR) = 0
unlink("file.txt") = 0

open("file.txt", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 4
read(3, ...)
read(3, ...)
write(4, ...) ...
#####

Can you supply us with: (a) the list of commands you invoked at the command-line to get these results; (b) some idea of the size of the file in question relative to the size of memory?

Thank you very much.

-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=127663

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About