unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [juanleon1@gmail.com: Problem at backup-buffer for writable files in not writable dirs]
@ 2005-03-20  0:22 Richard Stallman
  2005-03-20  4:33 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Stallman @ 2005-03-20  0:22 UTC (permalink / raw)


I think this change is correct--does anyone disagree?
Would someone please install this on Monday (and thank him)
if no objection has been found?

------- Start of forwarded message -------
Date: Fri, 18 Mar 2005 16:17:00 +0100
From: JUAN-LEON Lahoz Garcia <juanleon1@gmail.com>
To: emacs-pretest-bug@gnu.org
Subject: Problem at backup-buffer for writable files in not writable dirs
Sender: emacs-pretest-bug-bounces+rms=gnu.org@gnu.org
X-Spam-Status: No, hits=0.0 required=5.0
	tests=PATCH_UNIFIED_DIFF,RCVD_IN_ORBS
	version=2.55
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)


Hi,

When you edit and save a writable file in a non writable dir, and you
have `backup-by-copying' to nil (the default), backup-buffer fails to
make a backup in the place user has defined with variable
`backup-directory-alist' (because you cannot move files that are in a
not writable dir, despite of file ownership), so it copies it to file
"~/%backup%~".

[ I know having writable files in non writable files is not very
 usual, but I have to edit some conf files in such directories and I
 got this ~/%backup%~ file around all the time ]

IMHO this one-liner patch solves the problem, by detecting this
situation as one of the cases where a copy should be used to backup
the file instead of moving. You may want to review and/or apply it.

Regards
juanleon

- --- files.el.ori        Thu Mar 10 09:29:31 2005
+++ files.el    Thu Mar 10 10:02:00 2005
@@ -2686,6 +2686,7 @@
                             backup-by-copying
                             ;; Don't rename a suid or sgid file.
                             (and modes (< 0 (logand modes #o6000)))
+                             (not (file-writable-p (file-name-directory real-file-name)))
                             (and backup-by-copying-when-linked
                                  (> (file-nlinks real-file-name) 1))
                             (and (or backup-by-copying-when-mismatch





_______________________________________________
Emacs-pretest-bug mailing list
Emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [juanleon1@gmail.com: Problem at backup-buffer for writable files in not writable dirs]
  2005-03-20  0:22 [juanleon1@gmail.com: Problem at backup-buffer for writable files in not writable dirs] Richard Stallman
@ 2005-03-20  4:33 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2005-03-20  4:33 UTC (permalink / raw)
  Cc: emacs-devel

> From: Richard Stallman <rms@gnu.org>
> Date: Sat, 19 Mar 2005 19:22:14 -0500
> 
> I think this change is correct--does anyone disagree?
> Would someone please install this on Monday (and thank him)
> if no objection has been found?

You already asked me to install this, and I already did (and thanked
him).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-20  4:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-20  0:22 [juanleon1@gmail.com: Problem at backup-buffer for writable files in not writable dirs] Richard Stallman
2005-03-20  4:33 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).