GNU bug report logs - #10489
24.0.92; dired-do-copy may create infinite directory hierarchy

Previous Next

Package: emacs;

Reported by: michael_heerdegen <at> web.de

Date: Thu, 12 Jan 2012 19:36:01 UTC

Severity: important

Tags: patch

Merged with 11130

Found in version 24.0.92

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 10489 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>
Subject: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy
Date: Mon, 27 Feb 2012 19:34:21 +0100
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>>>> Because if we don't do that, we have to create new directory Test1 and
>>>> then test if Test1 is a subdir of Test.
>>> No we don't have to do that.  We can do the extra work in copy-directory
>>> (so we call file-equal-p on "~/test" rather than on "~/test/test1" when
>>> "~/test/test1" doesn't exist yet).
>> If you don't create test1, you will never have a value of
>> file-attributes for it, and file-directory-p will return always nil on
>> test1.
>
> I don't understand why you think that's a problem.
It's me who don't understand you, sorry.

We want to do:

(copy-directory "~/test" "~/test/test1")

"~/test/test1" is a non--existing directory.

Actually in copy-directory, I create "~/test/test1", and after doing
this, I check if this newly created directory is a subdir or "~/test" in
which case I exit with error.

If you don't create "test1" and file-subdir-of-p is unable to handle a
non--existing directory,I don't understand how you want to do.

It's so simple to do at start of function:

(file-subdir-of-p "~/test/test1" "~/test" 'noexist)

Where the NOEXIST arg allow file-subdir-of-p to bypass the
file-directory-p check (who will return nil on "test1").

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




This bug report was last modified 13 years and 58 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.