bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#66546: 30.0.50; save-buffer to write-protected file without backup f


From: Eli Zaretskii
Subject: bug#66546: 30.0.50; save-buffer to write-protected file without backup fails
Date: Thu, 19 Oct 2023 07:40:21 +0300

> From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
> Cc: 66546@debbugs.gnu.org
> Date: Wed, 18 Oct 2023 22:36:04 +0200
> 
> Why exactly do we need that
> 
>   (set-file-extended-attributes
>    buffer-file-name
>    (file-extended-attributes buffer-file-name))
> 
> incantation or the equivalent one
> 
>   (setq setmodes
>         (list (file-modes buffer-file-name)
>               (with-demoted-errors
>                   "Error getting extended attributes: %s"
>                 (file-extended-attributes buffer-file-name))
>               buffer-file-name))
>   (with-demoted-errors "Error setting attributes: %s"
>     (set-file-extended-attributes buffer-file-name
>                                   (nth 1 setmodes)))
> 
> in function `basic-save-buffer-2'?

Because it was added there long ago, and because we have no reason to
believe it does any harm.

> In addition, I tried to trace back (this time hopefully correctly) the
> origin of this call to `set-file-extended-attributes' and reached this
> commit:
> 
>   574c05e21947 Karel Klíc - Add SELinux support.
> 
> Karel added as comment on this function:
> 
>   (basic-save-buffer-2): Set SELinux context of the newly created file,
>   and return it.
> 
> But we do not have a "newly created file" here, and, in my opinion, do
> not need to set an SELinux context/extended attributes on it.

When working with Emacs, we usually respect old code unless we have a
clear-cut case where it is wrong.  Here, we don't.  Me, I don't even
know enough about SELinux to discuss this intelligently.  So let's
leave the code as it is, until we have a good reason to change it.
(And if and when we do decide to change it, we will need a good
understanding of what this will do to the several ACL frameworks we
currently support, before we know how to change it without introducing
subtle issues.)





reply via email to

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