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 13:15:16 +0300
User-agent: mu4e 1.4.10; emacs 26.3

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

Op 30-06-2020 om 16:42 schreef Benno Schulenberg:
From: Michalis Kokologiannakis <mixaskok@gmail.com>

The backup is made either by renaming the original file, or,
in case renaming fails, by copying it.

There's at least one problem with renaming the original file to
create a backup.  It means that when the buffer gets written out
to a new file, this new file is owned by the current user, and
if that user is not the same as the original owner...  Also, if
the file is edited by root, who has (at least on my machine) a
umask of 0022, it means the file has become unwritable for the
original owner.  :|

Fair point.

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?

So maybe copying the file is the easiest thing to do. Permissions might again be different, but this time for the backup.

Thank you,
Michalis

Benno



reply via email to

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