nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] files: improve the backup procedure to ensure no data is los


From: Benno Schulenberg
Subject: Re: [PATCH] files: improve the backup procedure to ensure no data is lost
Date: Wed, 1 Jul 2020 19:58:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

Op 01-07-2020 om 12:15 schreef Michalis Kokologiannakis:
> On Wed 01 Jul 2020 at 10:44, Benno Schulenberg <bensberg@telfort.nl> wrote:
>> So... I think we should skip the fastpath and just always copy
>> the current file to create a backup.  Or at least skip the
>> fastpath when the current user is not the owner of the file.
> 
> I can send out another version that implements either of these. I think 
> keeping
> the fastpath would be useful for when editing large files (and should cover a 
> lot
> of cases), but then special care would be required to make sure we also get
> correct things like ACLs, right?

Oof.  More complications we hadn't thought of.  :|  Another one was that
when 'backup_by_move' is true, the open() for the writing of the actual
file should use O_EXCL, not O_TRUNC.

So, let's take the simpler route: stay closest to what we have now, and
copy the file to make a backup.  This way permissions of the original
file are guaranteed to stay the same.  In bad situations nano may still
truncate the file, but then there will be a backup somewhere, and that
is what you set out to achieve: data resilience.

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]