unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4739: 23.1.50; recursive delete fails
@ 2009-10-16 20:02 ` Sven Joachim
  2009-10-23  8:12   ` Sven Joachim
  2009-10-24 20:40   ` bug#4739: marked as done (23.1.50; recursive delete fails) Emacs bug Tracking System
  0 siblings, 2 replies; 4+ messages in thread
From: Sven Joachim @ 2009-10-16 20:02 UTC (permalink / raw)
  To: emacs-pretest-bug

In the following situation Emacs signals an error:

$ mkdir -p /tmp/test
$ ln -s /tmp /tmp/test
$ emacs -Q /tmp

Now move point to the 'test' directory, type 'D' and confirm that you
want to delete the directory recursively.  An error message appears in
the echo area:
(file-error Removing directory Not a directory /tmp/test/tmp)


In GNU Emacs 23.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.18.2)
 of 2009-10-13 on turtle
(Sorry for not checking a newer version -- Savannah appears to be down,
 so I cannot upgrade ATM.)

Windowing system distributor `The X.Org Foundation', version 11.0.10605000
configured using `configure  '--build=i486-linux-gnu' 'build_alias=i486-linux-gnu' 'CFLAGS=-DGTK_DISABLE_DEPRECATED -g -O2''


Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  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: C
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-undo-mode: t
  display-time-mode: t
  auto-image-file-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x d / t m <tab> <return> M-x t o g g l e - d e b 
<tab> e r r <tab> <return> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> D y e s <return> 
<up> <return> C-h e M-x <up> <return> C-x 1 M-x e m 
a c s - v e s <backspace> r s i <tab> <return> M-x 
C-g C-x d ~ <return> M-x g n u s <return> C-g M-x <up> 
<return> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> SPC q M-x r e p o e <backspace> 
r t - e m <tab> <return>

Recent messages:
Checking new news...
Opening nnfolder server on archive...done
Opening nntp server on news.gnus.org...done
Opening nntp server on news.eternal-september.org...done
Checking new news...done
Retrieving newsgroup: gmane.emacs.devel...
Opening nntp server on news.gmane.org...done
Fetching headers for gmane.emacs.devel...done
Scoring...done
Generating summary...done

Load-path shadows:
None found.

Features:
(shadow ispell emacsbug sort gnus-cite smiley ansi-color mail-extr
gnus-async gnus-bcklg gnus-ml disp-table parse-time timezone byte-opt
bytecomp byte-compile nnfolder nndraft nnmh vc-git auth-source
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 epg-config mm-view smime dig nntp gnus-cache gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source format-spec gnus-start gnus-spec
gnus-int gnus-range message sendmail ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev gmm-utils mailheader canlock
sha1 hex-util hashcash gnus-win gnus gnus-ems nnheader gnus-util netrc
time-date mail-utils mm-util mail-prsvr wid-edit cus-start cus-load
dired-x dired-aux dired time server uniquify advice help-fns help-mode
easymenu view advice-preload po generic-x regexp-opt image-file paren
add-ons tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face text-properties overlay md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind gtk x-toolkit x multi-tty emacs)





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

* bug#4739: 23.1.50; recursive delete fails
  2009-10-16 20:02 ` bug#4739: 23.1.50; recursive delete fails Sven Joachim
@ 2009-10-23  8:12   ` Sven Joachim
  2009-10-23  8:20     ` Processed (with 5 errors): " Emacs bug Tracking System
  2009-10-24 20:40   ` bug#4739: marked as done (23.1.50; recursive delete fails) Emacs bug Tracking System
  1 sibling, 1 reply; 4+ messages in thread
From: Sven Joachim @ 2009-10-23  8:12 UTC (permalink / raw)
  To: 4739

tags 4739 patch

On 2009-10-16 22:02 +0200, Sven Joachim wrote:

> In the following situation Emacs signals an error:
>
> $ mkdir -p /tmp/test
> $ ln -s /tmp /tmp/test
> $ emacs -Q /tmp
>
> Now move point to the 'test' directory, type 'D' and confirm that you
> want to delete the directory recursively.  An error message appears in
> the echo area:
> (file-error Removing directory Not a directory /tmp/test/tmp)

Here is a patch that should fix this issue by testing whether the 
/tmp/test/tmp subdirectory is actually a symlink.  It uses the same
trick as the dired-delete-file function to test for that condition:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/files.el b/lisp/files.el
index ce9791f..6c43131 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4660,7 +4660,10 @@ If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well."
       (if (and recursive (not (file-symlink-p directory)))
 	  (mapc
 	   (lambda (file)
-	     (if (file-directory-p file)
+	     ;; This test is equivalent to
+	     ;; (and (file-directory-p file) (not (file-symlink-p file)))
+	     ;; but more efficient
+	     (if (eq t (car (file-attributes file)))
 		 (delete-directory file recursive)
 	       (delete-file file)))
 	   ;; We do not want to delete "." and "..".
--8<---------------cut here---------------end--------------->8---

Suggested ChangeLog entry:

2009-10-23  Sven Joachim  <svenjoac@gmx.de>

	* files.el (delete-directory): Don't fail recursive deletions if
	the directory contains a symlink to another directory (Bug #4739).






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

* Processed (with 5 errors): Re: bug#4739: 23.1.50; recursive delete fails
  2009-10-23  8:12   ` Sven Joachim
@ 2009-10-23  8:20     ` Emacs bug Tracking System
  0 siblings, 0 replies; 4+ messages in thread
From: Emacs bug Tracking System @ 2009-10-23  8:20 UTC (permalink / raw)
  To: Sven Joachim; +Cc: Emacs Bugs

Processing commands for control@emacsbugs.donarmstrong.com:

> tags 4739 patch
Bug #4739 [emacs] 23.1.50; recursive delete fails
Added tag(s) patch.
> On 2009-10-16 22:02 +0200, Sven Joachim wrote:
Unknown command or malformed arguments to command.

> > In the following situation Emacs signals an error:
Unknown command or malformed arguments to command.

> >
Unknown command or malformed arguments to command.

> > $ mkdir -p /tmp/test
Unknown command or malformed arguments to command.

> > $ ln -s /tmp /tmp/test
Unknown command or malformed arguments to command.

Too many unknown commands, stopping here.

Please contact me if you need assistance.

Don Armstrong
(administrator, Emacs bugs database)




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

* bug#4739: marked as done (23.1.50; recursive delete fails)
  2009-10-16 20:02 ` bug#4739: 23.1.50; recursive delete fails Sven Joachim
  2009-10-23  8:12   ` Sven Joachim
@ 2009-10-24 20:40   ` Emacs bug Tracking System
  1 sibling, 0 replies; 4+ messages in thread
From: Emacs bug Tracking System @ 2009-10-24 20:40 UTC (permalink / raw)
  To: Chong Yidong

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

Your message dated Sat, 24 Oct 2009 16:32:12 -0400
with message-id <877hukedo3.fsf@stupidchicken.com>
and subject line Re: 23.1.50; recursive delete fails
has caused the Emacs bug report #4739,
regarding 23.1.50; recursive delete fails
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 owner@emacsbugs.donarmstrong.com
immediately.)


-- 
4739: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4739
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

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

From: Sven Joachim <svenjoac@gmx.de>
To: emacs-pretest-bug@gnu.org
Subject: 23.1.50; recursive delete fails
Date: Fri, 16 Oct 2009 22:02:45 +0200
Message-ID: <87eip3ksyi.fsf@turtle.gmx.de>

In the following situation Emacs signals an error:

$ mkdir -p /tmp/test
$ ln -s /tmp /tmp/test
$ emacs -Q /tmp

Now move point to the 'test' directory, type 'D' and confirm that you
want to delete the directory recursively.  An error message appears in
the echo area:
(file-error Removing directory Not a directory /tmp/test/tmp)


In GNU Emacs 23.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.18.2)
 of 2009-10-13 on turtle
(Sorry for not checking a newer version -- Savannah appears to be down,
 so I cannot upgrade ATM.)

Windowing system distributor `The X.Org Foundation', version 11.0.10605000
configured using `configure  '--build=i486-linux-gnu' 'build_alias=i486-linux-gnu' 'CFLAGS=-DGTK_DISABLE_DEPRECATED -g -O2''


Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  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: C
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-undo-mode: t
  display-time-mode: t
  auto-image-file-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x d / t m <tab> <return> M-x t o g g l e - d e b 
<tab> e r r <tab> <return> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> D y e s <return> 
<up> <return> C-h e M-x <up> <return> C-x 1 M-x e m 
a c s - v e s <backspace> r s i <tab> <return> M-x 
C-g C-x d ~ <return> M-x g n u s <return> C-g M-x <up> 
<return> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> SPC q M-x r e p o e <backspace> 
r t - e m <tab> <return>

Recent messages:
Checking new news...
Opening nnfolder server on archive...done
Opening nntp server on news.gnus.org...done
Opening nntp server on news.eternal-september.org...done
Checking new news...done
Retrieving newsgroup: gmane.emacs.devel...
Opening nntp server on news.gmane.org...done
Fetching headers for gmane.emacs.devel...done
Scoring...done
Generating summary...done

Load-path shadows:
None found.

Features:
(shadow ispell emacsbug sort gnus-cite smiley ansi-color mail-extr
gnus-async gnus-bcklg gnus-ml disp-table parse-time timezone byte-opt
bytecomp byte-compile nnfolder nndraft nnmh vc-git auth-source
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 epg-config mm-view smime dig nntp gnus-cache gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source format-spec gnus-start gnus-spec
gnus-int gnus-range message sendmail ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev gmm-utils mailheader canlock
sha1 hex-util hashcash gnus-win gnus gnus-ems nnheader gnus-util netrc
time-date mail-utils mm-util mail-prsvr wid-edit cus-start cus-load
dired-x dired-aux dired time server uniquify advice help-fns help-mode
easymenu view advice-preload po generic-x regexp-opt image-file paren
add-ons tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face text-properties overlay md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind gtk x-toolkit x multi-tty emacs)


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

From: Chong Yidong <cyd@stupidchicken.com>
To: Sven Joachim <svenjoac@gmx.de>
Cc: 4739-done@emacsbugs.donarmstrong.com
Subject: Re: 23.1.50; recursive delete fails
Date: Sat, 24 Oct 2009 16:32:12 -0400
Message-ID: <877hukedo3.fsf@stupidchicken.com>

> Here is a patch that should fix this issue by testing whether the
> /tmp/test/tmp subdirectory is actually a symlink.  It uses the same
> trick as the dired-delete-file function to test for that condition:

Thanks.  The patch looks good, and I've checked it in.

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

end of thread, other threads:[~2009-10-24 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <877hukedo3.fsf@stupidchicken.com>
2009-10-16 20:02 ` bug#4739: 23.1.50; recursive delete fails Sven Joachim
2009-10-23  8:12   ` Sven Joachim
2009-10-23  8:20     ` Processed (with 5 errors): " Emacs bug Tracking System
2009-10-24 20:40   ` bug#4739: marked as done (23.1.50; recursive delete fails) 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).