On Mon, Mar 07, 2016 at 04:10:03PM -0800, Tony Cook via RT wrote: > On Sun Mar 06 02:32:46 2016, jiangyy@outlook.com wrote: > > the file-system runs out of space (when the replaced text is longer) > > It isn't necessary for the replaced text to be longer. > > We're unlinking the file, but keeping a file handle open to it. On a > POSIX system the file will continue to take space until the file handle > is closed. For anyone following this ticket, a simple demonstration of why -i is currently unsafe: Here foo gets completely truncated: $ echo "hello" > foo; ./perl -i -pe'die' foo Died at -e line 1, <> line 1. $ ls -l foo -rw-rw-r--. 1 davem davem 0 Apr 5 15:49 foo $ and here foo gets partially truncated: $ perl -le'print "a" x 80 for 1..10_000' > foo $ ls -l foo -rw-rw-r--. 1 davem davem 810000 Apr 5 15:51 foo $ ./perl -i -pe'die if $. == 9_900' foo Died at -e line 1, <> line 9900. $ ls -l foo -rw-rw-r--. 1 davem davem 801819 Apr 5 15:52 foo $ -- It's not that I'm afraid to die, I just don't want to be there when it happens. -- Woody AllenThread Previous | Thread Next