From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#5982: 23.1.96; Dired regression - recursive copies turn symlinks into regular files Date: Tue, 20 Apr 2010 10:54:27 -0400 Message-ID: <87sk6qqin0.fsf@stupidchicken.com> References: <877ho2jx07.fsf@turtle.gmx.de> <87wrw2i68i.fsf@turtle.gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1271775588 5957 80.91.229.12 (20 Apr 2010 14:59:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 20 Apr 2010 14:59:48 +0000 (UTC) Cc: 5982@debbugs.gnu.org, Sven Joachim To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 20 16:59:46 2010 connect(): No such file or directory Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O4EvR-0004Zd-SP for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Apr 2010 16:59:46 +0200 Original-Received: from localhost ([127.0.0.1]:41201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4EvO-0004QY-AE for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Apr 2010 10:59:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4Ev3-0004Jd-Fp for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 10:59:21 -0400 Original-Received: from [140.186.70.92] (port=50135 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4Ev1-0004Iq-LZ for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 10:59:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4Euy-0004dV-Lx for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 10:59:19 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58978) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4Euy-0004dM-Hs for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 10:59:16 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1O4Eqs-0006QH-9u; Tue, 20 Apr 2010 10:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Apr 2010 14:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5982 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 5982-submit@debbugs.gnu.org id=B5982.127177527524682 (code B ref 5982); Tue, 20 Apr 2010 14:55:02 +0000 Original-Received: (at 5982) by debbugs.gnu.org; 20 Apr 2010 14:54:35 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4EqQ-0006Q3-Iy for submit@debbugs.gnu.org; Tue, 20 Apr 2010 10:54:34 -0400 Original-Received: from pantheon-po30.its.yale.edu ([130.132.50.4]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4EqO-0006Px-Ls for 5982@debbugs.gnu.org; Tue, 20 Apr 2010 10:54:33 -0400 Original-Received: from furry (dhcp128036014104.central.yale.edu [128.36.14.104]) (authenticated bits=0) by pantheon-po30.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o3KEsReL017360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 20 Apr 2010 10:54:27 -0400 Original-Received: by furry (Postfix, from userid 1000) id BBFAFC055; Tue, 20 Apr 2010 10:54:27 -0400 (EDT) In-Reply-To: <87wrw2i68i.fsf@turtle.gmx.de> (Sven Joachim's message of "Tue, 20 Apr 2010 15:49:33 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.96 (gnu/linux) X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 20 Apr 2010 10:55:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:36362 Archived-At: Sven Joachim writes: > On 2010-04-20 11:26 +0200, Sven Joachim wrote: > >> Suppose we have the following directory in dired: >> >> ,---- >> | /tmp/foo: >> | total used in directory 4 available 1674380 >> | drwxr-xr-x 2 sven sven 80 Apr 20 11:12 . >> | drwxrwxrwt 14 root root 300 Apr 20 11:12 .. >> | -rw-r--r-- 1 sven sven 6 Apr 20 11:09 bar >> | lrwxrwxrwx 1 sven sven 3 Apr 20 11:12 bar2 -> bar >> `---- >> >> Now type ^ to cd to the parent directory, move to the "foo" line and >> press "C /tmp/foo2 RET yes" (confirming the recursive copy and creating >> /tmp/foo2) and switch to the new directory. It looks like this: >> >> ,---- >> | /tmp/foo2: >> | total used in directory 8 available 1674380 >> | drwxr-xr-x 2 sven sven 80 Apr 20 11:12 . >> | drwxrwxrwt 14 root root 300 Apr 20 11:12 .. >> | -rw-r--r-- 1 sven sven 6 Apr 20 11:09 bar >> | -rw-r--r-- 1 sven sven 6 Apr 20 11:09 bar2 >> `---- >> >> This is a regression from Emacs 23.1 and 22.3 where the symlink would be >> copied as such instead of turning into a regular file. > > Bisecting shows that this problem first occured in revision 97979 when > dired-copy-file-recursive started to use the new copy-directory command > (added in revision 97978). The latter just calls copy-file for > non-directories, and copy-file has no option to preserve symlinks. The following patch would add symlink copying to `copy-directory'. Michael, could you review the patch carefully, or suggest some other solution? *** lisp/files.el 2010-03-11 16:25:46 +0000 --- lisp/files.el 2010-04-20 14:50:35 +0000 *************** *** 4735,4744 **** (mapc (lambda (file) (let ((target (expand-file-name ! (file-name-nondirectory file) newname))) ! (if (file-directory-p file) ! (copy-directory file target keep-time parents) ! (copy-file file target t keep-time)))) ;; We do not want to copy "." and "..". (directory-files directory 'full directory-files-no-dot-files-regexp)) --- 4735,4748 ---- (mapc (lambda (file) (let ((target (expand-file-name ! (file-name-nondirectory file) newname)) ! (attrs (file-attributes file))) ! (cond ((file-directory-p file) ! (copy-directory file target keep-time parents)) ! ((stringp (car attrs)) ; Symbolic link ! (make-symbolic-link (car attrs) target t)) ! (t ! (copy-file file target t keep-time))))) ;; We do not want to copy "." and "..". (directory-files directory 'full directory-files-no-dot-files-regexp))