unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5343: 23.1.91; recursive directory copying is broken
@ 2010-01-08 23:14 ` Stephen Berman
  2010-01-09 21:53   ` Stephen Berman
  2010-01-13 10:56   ` bug#5343: marked as done (23.1.91; recursive directory copying is broken) Emacs bug Tracking System
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Berman @ 2010-01-08 23:14 UTC (permalink / raw)
  To: emacs-pretest-bug

1. emacs -Q
2. Make a directory /tmp/test, add to it a file named "a" and a
   directory named "test", and add to /tmp/test/test a file named "b".
3. Type `M-x copy-directory RET /tmp/test RET ~ RET' to copy /tmp/test
   recursively to ~.
4. Type `C-x d' and at the prompt `~' to visit ~ in Dired, put the
   cursor on the directory "test" and type `i' to open "test" as a
   subdirectory.  This is the result:

  /home/steve/test:
  total used in directory 16 available 7794948
  -rw-r--r--  1 steve users    4 2010-01-08 23:57 a
  -rw-r--r--  1 steve users    7 2010-01-08 23:57 b

Using `C' in Dired gives the same broken result.  In Emacs 23.1
recursive directory copying by `C' in Dired (copy-directory does not
exist in 23.1) works correctly, i.e., shows this:

  /home/steve/test:
  total used in directory 16 available 7794944
  -rw-r--r--  1 steve users    4 2010-01-08 23:31 a
  drwxr-xr-x  2 steve users 4096 2010-01-09 00:06 test

  /home/steve/test/test:
  total used in directory 12 available 7794944
  -rw-r--r-- 1 steve users    7 2010-01-08 23:32 b


In GNU Emacs 23.1.91.1 (i686-pc-linux-gnu, GTK+ Version 2.18.1)
 of 2010-01-06 on escher
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t






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

* bug#5343: 23.1.91; recursive directory copying is broken
  2010-01-08 23:14 ` bug#5343: 23.1.91; recursive directory copying is broken Stephen Berman
@ 2010-01-09 21:53   ` Stephen Berman
  2010-01-10  2:14     ` Lennart Borgman
  2010-01-12 22:07     ` Michael Albinus
  2010-01-13 10:56   ` bug#5343: marked as done (23.1.91; recursive directory copying is broken) Emacs bug Tracking System
  1 sibling, 2 replies; 6+ messages in thread
From: Stephen Berman @ 2010-01-09 21:53 UTC (permalink / raw)
  To: 5343

On Sat, 09 Jan 2010 00:14:58 +0100 Stephen Berman <stephen.berman@gmx.net> wrote:

> 1. emacs -Q
> 2. Make a directory /tmp/test, add to it a file named "a" and a
>    directory named "test", and add to /tmp/test/test a file named "b".
> 3. Type `M-x copy-directory RET /tmp/test RET ~ RET' to copy /tmp/test
>    recursively to ~.
> 4. Type `C-x d' and at the prompt `~' to visit ~ in Dired, put the
>    cursor on the directory "test" and type `i' to open "test" as a
>    subdirectory.  This is the result:
>
>   /home/steve/test:
>   total used in directory 16 available 7794948
>   -rw-r--r--  1 steve users    4 2010-01-08 23:57 a
>   -rw-r--r--  1 steve users    7 2010-01-08 23:57 b

This is due to the following code in copy-directory:

    (if (and (file-directory-p newname)
             (not (string-equal (file-name-nondirectory directory)
    				(file-name-nondirectory newname))))
	(setq newname
	      (expand-file-name (file-name-nondirectory directory) newname)))

Specifically, the equality check prevents newname from being changed
from "home/steve/test" to "home/steve/test/test".  Removing this check,
as in the below patch, fixes the above breakage.  I don't see any real
problem this check prevents, but maybe I'm overlooking something.

Steve Berman

2010-01-09  Stephen Berman  <stephen.berman@gmx.net>

	* files.el (copy-directory): Don't check equality of source and
	target nondirectory names (bug#5343).

*** /tmp/ediff7644I7H	2010-01-09 22:23:07.000000000 +0100
--- /home/steve/bzr/emacs/quickfixes/lisp/files.el	2010-01-09 21:41:52.000000000 +0100
***************
*** 4714,4722 ****
        ;; Compute target name.
        (setq directory (directory-file-name (expand-file-name directory))
  	    newname   (directory-file-name (expand-file-name newname)))
!       (if (and (file-directory-p newname)
! 	       (not (string-equal (file-name-nondirectory directory)
! 				  (file-name-nondirectory newname))))
  	  (setq newname
  		(expand-file-name (file-name-nondirectory directory) newname)))
        (if (not (file-directory-p newname)) (make-directory newname parents))
--- 4714,4720 ----
        ;; Compute target name.
        (setq directory (directory-file-name (expand-file-name directory))
  	    newname   (directory-file-name (expand-file-name newname)))
!       (if (file-directory-p newname)
  	  (setq newname
  		(expand-file-name (file-name-nondirectory directory) newname)))
        (if (not (file-directory-p newname)) (make-directory newname parents))






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

* bug#5343: 23.1.91; recursive directory copying is broken
  2010-01-09 21:53   ` Stephen Berman
@ 2010-01-10  2:14     ` Lennart Borgman
  2010-01-12 22:07     ` Michael Albinus
  1 sibling, 0 replies; 6+ messages in thread
From: Lennart Borgman @ 2010-01-10  2:14 UTC (permalink / raw)
  To: Stephen Berman, 5343

On Sat, Jan 9, 2010 at 10:53 PM, Stephen Berman <stephen.berman@gmx.net> wrote:
> On Sat, 09 Jan 2010 00:14:58 +0100 Stephen Berman <stephen.berman@gmx.net> wrote:
>
>> 1. emacs -Q
>> 2. Make a directory /tmp/test, add to it a file named "a" and a
>>    directory named "test", and add to /tmp/test/test a file named "b".
>> 3. Type `M-x copy-directory RET /tmp/test RET ~ RET' to copy /tmp/test
>>    recursively to ~.
>> 4. Type `C-x d' and at the prompt `~' to visit ~ in Dired, put the
>>    cursor on the directory "test" and type `i' to open "test" as a
>>    subdirectory.  This is the result:
>>
>>   /home/steve/test:
>>   total used in directory 16 available 7794948
>>   -rw-r--r--  1 steve users    4 2010-01-08 23:57 a
>>   -rw-r--r--  1 steve users    7 2010-01-08 23:57 b
>
> This is due to the following code in copy-directory:
>
>    (if (and (file-directory-p newname)
>             (not (string-equal (file-name-nondirectory directory)
>                                (file-name-nondirectory newname))))
>        (setq newname
>              (expand-file-name (file-name-nondirectory directory) newname)))
>
> Specifically, the equality check prevents newname from being changed
> from "home/steve/test" to "home/steve/test/test".  Removing this check,
> as in the below patch, fixes the above breakage.  I don't see any real
> problem this check prevents, but maybe I'm overlooking something.


The check looks strange to me. I wonder if the intention really was to
prevent copying a directory tree into a subdirectory below itself? But
if so, should not the check be a bit different?


BTW, I looked at the variable `directory-files-no-dot-files-regexp'. I
minor issue, but should it not be

(defconst directory-files-no-dot-files-regexp
  "^\\(?:[^.]\\|\\.\\(?:[^.]\\|\\..\\)\\)"
  "Regexp of file names excluging \".\" an \"..\".")






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

* bug#5343: 23.1.91; recursive directory copying is broken
  2010-01-09 21:53   ` Stephen Berman
  2010-01-10  2:14     ` Lennart Borgman
@ 2010-01-12 22:07     ` Michael Albinus
  2010-01-13 10:52       ` Stephen Berman
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2010-01-12 22:07 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 5343

Stephen Berman <stephen.berman@gmx.net> writes:

>> 1. emacs -Q
>> 2. Make a directory /tmp/test, add to it a file named "a" and a
>>    directory named "test", and add to /tmp/test/test a file named "b".
>> 3. Type `M-x copy-directory RET /tmp/test RET ~ RET' to copy /tmp/test
>>    recursively to ~.
>> 4. Type `C-x d' and at the prompt `~' to visit ~ in Dired, put the
>>    cursor on the directory "test" and type `i' to open "test" as a
>>    subdirectory.  This is the result:
>>
>>   /home/steve/test:
>>   total used in directory 16 available 7794948
>>   -rw-r--r--  1 steve users    4 2010-01-08 23:57 a
>>   -rw-r--r--  1 steve users    7 2010-01-08 23:57 b

Should be fixed now. However, the patch is a little bit different from
yours.

> This is due to the following code in copy-directory:
>
>     (if (and (file-directory-p newname)
>              (not (string-equal (file-name-nondirectory directory)
>     				(file-name-nondirectory newname))))
> 	(setq newname
> 	      (expand-file-name (file-name-nondirectory directory) newname)))
>
> Specifically, the equality check prevents newname from being changed
> from "home/steve/test" to "home/steve/test/test".  Removing this check,
> as in the below patch, fixes the above breakage.  I don't see any real
> problem this check prevents, but maybe I'm overlooking something.

IIRC, there were some problems when copying a directory into an existing
one. Cannot remember the exact test case, because I haven't written a
comment about.

> Steve Berman

Best regards, Michael.






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

* bug#5343: 23.1.91; recursive directory copying is broken
  2010-01-12 22:07     ` Michael Albinus
@ 2010-01-13 10:52       ` Stephen Berman
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Berman @ 2010-01-13 10:52 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 5343

On Tue, 12 Jan 2010 23:07:31 +0100 Michael Albinus <michael.albinus@gmx.de> wrote:

> Stephen Berman <stephen.berman@gmx.net> writes:
>
>>> 1. emacs -Q
>>> 2. Make a directory /tmp/test, add to it a file named "a" and a
>>>    directory named "test", and add to /tmp/test/test a file named "b".
>>> 3. Type `M-x copy-directory RET /tmp/test RET ~ RET' to copy /tmp/test
>>>    recursively to ~.
>>> 4. Type `C-x d' and at the prompt `~' to visit ~ in Dired, put the
>>>    cursor on the directory "test" and type `i' to open "test" as a
>>>    subdirectory.  This is the result:
>>>
>>>   /home/steve/test:
>>>   total used in directory 16 available 7794948
>>>   -rw-r--r--  1 steve users    4 2010-01-08 23:57 a
>>>   -rw-r--r--  1 steve users    7 2010-01-08 23:57 b
>
> Should be fixed now.

I confirm it's fixed.  Thanks!

Steve Berman






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

* bug#5343: marked as done (23.1.91; recursive directory copying is broken)
  2010-01-08 23:14 ` bug#5343: 23.1.91; recursive directory copying is broken Stephen Berman
  2010-01-09 21:53   ` Stephen Berman
@ 2010-01-13 10:56   ` Emacs bug Tracking System
  1 sibling, 0 replies; 6+ messages in thread
From: Emacs bug Tracking System @ 2010-01-13 10:56 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-bug-tracker

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

Your message dated Wed, 13 Jan 2010 11:55:54 +0100
with message-id <nqljg2tgsl.fsf@alcatel-lucent.com>
and subject line Re: bug#5343: 23.1.91; recursive directory copying is broken
has caused the Emacs bug report #5343,
regarding 23.1.91; recursive directory copying is broken
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact bug-gnu-emacs@gnu.org
immediately.)


-- 
5343: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5343
Emacs Bug Tracking System
Contact bug-gnu-emacs@gnu.org with problems

[-- Attachment #2: Type: message/rfc822, Size: 4694 bytes --]

From: Stephen Berman <stephen.berman@gmx.net>
To: emacs-pretest-bug@gnu.org
Subject: 23.1.91; recursive directory copying is broken
Date: Sat, 09 Jan 2010 00:14:58 +0100
Message-ID: <87fx6gkx3h.fsf@escher.home>

1. emacs -Q
2. Make a directory /tmp/test, add to it a file named "a" and a
   directory named "test", and add to /tmp/test/test a file named "b".
3. Type `M-x copy-directory RET /tmp/test RET ~ RET' to copy /tmp/test
   recursively to ~.
4. Type `C-x d' and at the prompt `~' to visit ~ in Dired, put the
   cursor on the directory "test" and type `i' to open "test" as a
   subdirectory.  This is the result:

  /home/steve/test:
  total used in directory 16 available 7794948
  -rw-r--r--  1 steve users    4 2010-01-08 23:57 a
  -rw-r--r--  1 steve users    7 2010-01-08 23:57 b

Using `C' in Dired gives the same broken result.  In Emacs 23.1
recursive directory copying by `C' in Dired (copy-directory does not
exist in 23.1) works correctly, i.e., shows this:

  /home/steve/test:
  total used in directory 16 available 7794944
  -rw-r--r--  1 steve users    4 2010-01-08 23:31 a
  drwxr-xr-x  2 steve users 4096 2010-01-09 00:06 test

  /home/steve/test/test:
  total used in directory 12 available 7794944
  -rw-r--r-- 1 steve users    7 2010-01-08 23:32 b


In GNU Emacs 23.1.91.1 (i686-pc-linux-gnu, GTK+ Version 2.18.1)
 of 2010-01-06 on escher
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t



[-- Attachment #3: Type: message/rfc822, Size: 2666 bytes --]

From: Michael Albinus <michael.albinus@gmx.de>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: 5343-done@debbugs.gnu.org
Subject: Re: bug#5343: 23.1.91; recursive directory copying is broken
Date: Wed, 13 Jan 2010 11:55:54 +0100
Message-ID: <nqljg2tgsl.fsf@alcatel-lucent.com>

Stephen Berman <stephen.berman@gmx.net> writes:

> I confirm it's fixed.  Thanks!

Closing bug in debbugs.

> Steve Berman

Best regards, Michael.


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

end of thread, other threads:[~2010-01-13 10:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <nqljg2tgsl.fsf@alcatel-lucent.com>
2010-01-08 23:14 ` bug#5343: 23.1.91; recursive directory copying is broken Stephen Berman
2010-01-09 21:53   ` Stephen Berman
2010-01-10  2:14     ` Lennart Borgman
2010-01-12 22:07     ` Michael Albinus
2010-01-13 10:52       ` Stephen Berman
2010-01-13 10:56   ` bug#5343: marked as done (23.1.91; recursive directory copying is broken) Emacs bug Tracking System

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).