[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: |
Jens Schmidt |
Subject: |
bug#66546: 30.0.50; save-buffer to write-protected file without backup fails |
Date: |
Mon, 16 Oct 2023 22:04:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
>> Cc: 66546@debbugs.gnu.org
>> Date: Sun, 15 Oct 2023 20:59:42 +0200
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > In that case, does the change below fix the original problem?
>>
>> It does, thanks.
>
> I've now installed that on the master branch.
Thanks. Now that's out of the way, should I then work on what I have
called issue B in the initial message and on ERT tests for both issues?
Or do you still think there is more discussion required on these
beforehand?
>> > + ;; If set-file-extended-attributes fails to make the
>> > + ;; file writable, fall back on set-file-modes.
>> > + (with-demoted-errors "Error setting attributes: %s"
>> > + (set-file-extended-attributes buffer-file-name
>> > + (nth 1 setmodes)))
>>
>> How exactly could above call to `set-file-extended-attributes' *succeed*
>> to make the file writable?
>
> I don't know, and I don't think we should care. Due to the
> above-mentioned system-dependencies, Emacs generally treats extended
> attributes as opaque objects, and only tries hard to preserve them
> where expected. So the above is our best effort to preserve the
> attributes, which is why we call set-file-modes only if absolutely
> necessary, since doing that in general affects the extended
> attributes.
That explains (partially) what I did not understand in your solution.
But still, to me it seems that the two forms
(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)))
, if limiting them to the extended attribute calls and if ignoring outer
context, could be simplified to
(set-file-extended-attributes
buffer-file-name
(file-extended-attributes buffer-file-name))
(If not, why not?)
And wouldn't that be, in this context, just a no-op?
I fully understand that the extended attributes stored in `setmodes' are
required later to restore the attributes of the file after it has been
written to. And in that context I understand why we call
`set-file-extended-attributes'. But here not really, yet.
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/14
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/14
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/14
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/15
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/15
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/15
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/15
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/15
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/15
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/16
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails,
Jens Schmidt <=
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/17
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/17
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/18
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/18
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/19
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/19
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/20
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/21
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Eli Zaretskii, 2023/10/21
- bug#66546: 30.0.50; save-buffer to write-protected file without backup fails, Jens Schmidt, 2023/10/21