Skip Menu |
 

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

Report information
The Basics
Id: 73919
Status: open
Priority: 0/
Queue: File-Slurp

People
Owner: Nobody in particular
Requestors: MITHUN [...] cpan.org
Cc:
AdminCc:

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



Subject: append and atomic does not work as expected
Download (untitled) / with headers
text/plain 196b
Calling write_file($filename, {append => 1, atomic => 1, }, $data); does not append to an existing file. Rather, the existing file is _atomically_ overwritten with new data. Thanks, Mithun
Download (untitled) / with headers
text/plain 707b
On Thu Jan 12 09:29:33 2012, MITHUN wrote: Show quoted text
> Calling > > write_file($filename, {append => 1, atomic => 1, }, $data); > > does not append to an existing file. Rather, the existing file is > _atomically_ overwritten with > new data. > > Thanks, > Mithun
Still present in repository as of commit 98c4a18d264f48e629f8a0df54370b22fcf95d65. ##### $ cat alpha alpha $ cat 73919-write-file.pl #!/usr/bin/env perl use 5.14.0; use warnings; use File::Slurp qw( write_file ); my $filename = 'alpha'; my $data = "beta\n"; write_file($filename, { append => 1, atomic => 1 }, $data); $ perl -I/home/jkeenan/gitwork/zzzothers/slurp/lib 73919-write-file.pl ; cat alpha beta ##### Thank you very much. Jim Keenan
Subject: 73919-write-file.pl
Download 73919-write-file.pl
text/x-perl 188b
#!/usr/bin/env perl use 5.14.0; use warnings; use File::Slurp qw( write_file ); my $filename = 'alpha'; my $data = "beta\n"; write_file($filename, { append => 1, atomic => 1 }, $data);
Subject: Re: [rt.cpan.org #73919] append and atomic does not work as expected
Date: Wed, 10 Oct 2018 11:51:42 -0400
To: bug-File-Slurp [...] rt.cpan.org
From: Uri Guttman <uri [...] stemsystems.com>
Download (untitled) / with headers
text/plain 1.2k
On 10/10/2018 11:47 AM, James E Keenan via RT wrote: Show quoted text
> Queue: File-Slurp > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=73919 > > > On Thu Jan 12 09:29:33 2012, MITHUN wrote:
>> Calling >> >> write_file($filename, {append => 1, atomic => 1, }, $data); >> >> does not append to an existing file. Rather, the existing file is >> _atomically_ overwritten with >> new data. >> >> Thanks, >> Mithun
> Still present in repository as of commit 98c4a18d264f48e629f8a0df54370b22fcf95d65. > > ##### > $ cat alpha > alpha > > $ cat 73919-write-file.pl > #!/usr/bin/env perl > use 5.14.0; > use warnings; > use File::Slurp qw( write_file ); > > my $filename = 'alpha'; > my $data = "beta\n"; > > write_file($filename, { append => 1, atomic => 1 }, $data); > > $ perl -I/home/jkeenan/gitwork/zzzothers/slurp/lib 73919-write-file.pl ; cat alpha > beta > ##### > > Thank you very much. > Jim Keenan >
i think that using both append and atomic should be an error. it would be very hard to append in atomic mode. you would need to copy the file, append and then rename. i had never thought of doing append in atomic mode. append was for adding to log files and similar. if the write size is small enough (less than what syswrite can do) it will be atomic anyway as kernel writes are not broken up. just my thoughts, uri


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.