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: Jens Schmidt
Subject: bug#66546: 30.0.50; save-buffer to write-protected file without backup fails
Date: Sun, 15 Oct 2023 20:59:42 +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 13:39:04 +0200

>> Yes!  Thanks for guessing :-)
>>
>> And I have been asking a related question implicitly in the previous
>> conversation, so here is it explicitly:
>
> In that case, does the change below fix the original problem?

It does, thanks.

>> Using *only* the extended-attribute Elisp functions and objects, is
>> there currently a way to implement the equivalent of "chmod u+w FILE" in
>> Elisp?

> AFAIU, this question has no meaningful answer.  Extended attributes
> are much more fine-grained than the "traditional" file mode bits; in
> particular, they are incompatible with the "user" notion to fit the
> "u" part of "u+w": the same file can be writable by a specific user or
> group of users, and unwritable by others.  Even if you only limit
> yourself to Posix extended attributes (and Emacs doesn't limit itself
> to that), there's no good answer to your question.

Then pls let me ask a more general question.  Given a sequence

  (setq ext-attrs (file-extended-attributes file-name))
  (setq ext-attrs (funcall func ext-attrs))
  (set-file-extended-attributes file-name ext-attrs)

is there any Elisp function FUNC so that the extended attributes on
FILE-NAME as seen by the OS change by executing that sequence?

> +            ;; 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?

> +            (unless (file-writable-p buffer-file-name)





reply via email to

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