unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: JUAN-LEON Lahoz Garcia <juanleon1@gmail.com>
Subject: Problem at backup-buffer for writable files in not writable dirs
Date: Thu, 10 Mar 2005 10:17:37 +0100	[thread overview]
Message-ID: <m37jkfx3ke.fsf@kaliban.madrid.ecid.cig.mot.com> (raw)


Hi,

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

[ I know this 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. 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

                 reply	other threads:[~2005-03-10  9:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m37jkfx3ke.fsf@kaliban.madrid.ecid.cig.mot.com \
    --to=juanleon1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).