all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sven Joachim <svenjoac@gmx.de>
To: rms@gnu.org
Cc: emacs-pretest-bug@gnu.org
Subject: Re: Recursive copies in Dired do not preserve directory permissions
Date: Sat, 27 Oct 2007 20:21:38 +0200	[thread overview]
Message-ID: <87wst8fmfh.fsf@gmx.de> (raw)
In-Reply-To: <E1IjVC1-00078L-9Z@fencepost.gnu.org> (Richard Stallman's message of "Sun\, 21 Oct 2007 03\:25\:49 -0400")

I have now looked into this myself and prepared a minimal patch
(against EMACS_22_BASE) which seems to work.  During that I discovered
another small issue: if a source directory is not readable, the
corresponding target directory is not created.  Before I investigate
that, I'd like to get comments on the following patch, though:

Index: dired-aux.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired-aux.el,v
retrieving revision 1.151.2.2
diff -u -r1.151.2.2 dired-aux.el
--- dired-aux.el	8 Aug 2007 07:38:48 -0000	1.151.2.2
+++ dired-aux.el	27 Oct 2007 17:59:56 -0000
@@ -1162,7 +1162,8 @@
 	     (or (eq recursive 'always)
 		 (yes-or-no-p (format "Recursive copies of %s? " from))))
 	;; This is a directory.
-	(let ((files
+	(let ((mode (file-modes from))
+	      (files
 	       (condition-case err
 		   (directory-files from nil dired-re-no-dot)
 		 (file-error
@@ -1176,7 +1177,9 @@
 	    (if (file-exists-p to)
 		(or top (dired-handle-overwrite to))
 	      (condition-case err
-		  (make-directory to)
+		  (progn
+		    (make-directory to)
+		    (set-file-modes to #o700))
 		(file-error
 		 (push (dired-make-relative from)
 		       dired-create-files-failures)
@@ -1195,7 +1198,9 @@
 		(file-error
 		 (push (dired-make-relative thisfrom)
 		       dired-create-files-failures)
-		 (dired-log "Copying error for %s:\n%s\n" thisfrom err))))))
+		 (dired-log "Copying error for %s:\n%s\n" thisfrom err)))))
+	  (if (file-directory-p to)
+	      (set-file-modes to mode)))
       ;; Not a directory.
       (or top (dired-handle-overwrite to))
       (condition-case err


Changelog entry:

2007-10-27  Sven Joachim <svenjoac@gmx.de>

	* dired-aux.el (dired-copy-file-recursive): Preserve directory
	permissions.
	

  reply	other threads:[~2007-10-27 18:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-20 13:48 Recursive copies in Dired do not preserve directory permissions Sven Joachim
2007-10-21  7:25 ` Richard Stallman
2007-10-27 18:21   ` Sven Joachim [this message]
2007-10-28 13:51     ` Richard Stallman
2007-10-28 16:29       ` Sven Joachim
2007-10-31 17:01       ` Sven Joachim
2007-10-31 18:26         ` Juanma Barranquero
2007-10-31 20:11           ` Eli Zaretskii
2007-10-31 21:23             ` Jason Rumney

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

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

  git send-email \
    --in-reply-to=87wst8fmfh.fsf@gmx.de \
    --to=svenjoac@gmx.de \
    --cc=emacs-pretest-bug@gnu.org \
    --cc=rms@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.