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
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
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
#!/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>
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
Subject: Re: [rt.cpan.org #73919] append and atomic does not work as expected
Date: Fri, 05 Apr 2019 17:46:54 +1100
To: bug-File-Slurp [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
Uri Guttman <uri [...] stemsystems.com> writes: Show quoted text
> > 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.
Such a copy/append/rename could be cute. The new appended content would appear atomically. On the other hand, if don't want it to work, or not yet, then an error could be preferred over quietly overwriting.