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: Sat, 21 Oct 2023 22:02:26 +0300

> From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
> Cc: 66546@debbugs.gnu.org
> Date: Sat, 21 Oct 2023 19:56:44 +0200
> 
> >> +             ;; If we get an error writing the file which we
> >> +             ;; previously made writable, attempt to undo the
> >> +             ;; write-access.
> >> +             ((and (eq tempsetmodes 'u+w) (not success))
> >
> > Isn't it easier, safer, and more portable to compare buffer-file-name
> > with (nth 2 setmodes) instead?
> 
> I wanted to make 100% sure that we execute that first cond-branch if and
> only if we previously changed the file mode.  IOW, I feel I cannot
> exclude that by some strange configuration
> 
>   (equal buffer-file-name (nth 2 setmodes))
> 
> could also be true in other cases.

It doesn't matter which cases could cause this.  What matters is that
only when these two are identical that we need to make sure the file
ends up read-only as it was before the call to set-file-modes.

So please do make that change.





reply via email to

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