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: Michalis Kokologiannakis
Subject: Re: [PATCH] files: improve the backup procedure to ensure no data is lost
Date: Wed, 01 Jul 2020 23:28:00 +0300
User-agent: mu4e 1.4.10; emacs 26.3

On Wed 01 Jul 2020 at 20:58, Benno Schulenberg <bensberg@telfort.nl> wrote:

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.

And one more, just for the record. If the original file had hard links pointing to it, renaming the file to create the backup would make the links point to the backup...

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.

Agreed. I will follow up with an updated version.

Thank you,
Michalis

Benno



reply via email to

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