From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sven Joachim Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: Recursive copies in Dired do not preserve directory permissions Date: Sat, 27 Oct 2007 20:21:38 +0200 Message-ID: <87wst8fmfh.fsf@gmx.de> References: <874pgldhhu.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1193509245 6705 80.91.229.12 (27 Oct 2007 18:20:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Oct 2007 18:20:45 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 27 20:20:46 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IlqH8-0004FJ-1m for ged-emacs-devel@m.gmane.org; Sat, 27 Oct 2007 20:20:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IlqGy-0004Ov-Um for ged-emacs-devel@m.gmane.org; Sat, 27 Oct 2007 14:20:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IlqGo-0004ID-34 for emacs-devel@gnu.org; Sat, 27 Oct 2007 14:20:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IlqGm-0004GO-Jo for emacs-devel@gnu.org; Sat, 27 Oct 2007 14:20:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IlqGm-0004Fy-7h for emacs-devel@gnu.org; Sat, 27 Oct 2007 14:20:24 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IlqGl-0008C2-Sm for emacs-devel@gnu.org; Sat, 27 Oct 2007 14:20:23 -0400 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IlqGl-0006EN-Jv for emacs-pretest-bug@gnu.org; Sat, 27 Oct 2007 14:20:23 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1IlqGg-00089s-8v for emacs-pretest-bug@gnu.org; Sat, 27 Oct 2007 14:20:23 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IlqGf-00088w-Bg for emacs-pretest-bug@gnu.org; Sat, 27 Oct 2007 14:20:17 -0400 Original-Received: (qmail invoked by alias); 27 Oct 2007 18:20:15 -0000 Original-Received: from p54864F3E.dip.t-dialin.net (EHLO debian) [84.134.79.62] by mail.gmx.net (mp005) with SMTP; 27 Oct 2007 20:20:15 +0200 X-Authenticated: #28250155 X-Provags-ID: V01U2FsdGVkX1+DdTUgCmSDseKAS2wpBlQtZW8RaNmwGe6bp5Hygk iVNV1GMdfeKAjG In-Reply-To: (Richard Stallman's message of "Sun\, 21 Oct 2007 03\:25\:49 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:81869 gmane.emacs.pretest.bugs:20197 Archived-At: 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 * dired-aux.el (dired-copy-file-recursive): Preserve directory permissions.