From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.bugs Subject: bug#18063: 24.3; gnus-recursive-directory-files is fooled by upward symlinks Date: Tue, 22 Jul 2014 08:45:15 +0900 Organization: Emacsen advocacy group Message-ID: References: <871ttg6rs2.fsf@maritornes.cs.unb.ca> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1405986995 8307 80.91.229.3 (21 Jul 2014 23:56:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Jul 2014 23:56:35 +0000 (UTC) Cc: public-notmuch-gxuj+Tv9EO5zyzON3hdc1g@plane.gmane.org, public-bug-gnu-emacs-mXXj517/zsQ@plane.gmane.org To: 18063@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 22 01:56:26 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X9NRR-00045u-TW for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Jul 2014 01:56:26 +0200 Original-Received: from localhost ([::1]:36841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9NRR-0006Yt-LG for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Jul 2014 19:56:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9NRF-0006Xp-RM for bug-gnu-emacs@gnu.org; Mon, 21 Jul 2014 19:56:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X9NR5-0003gs-Qd for bug-gnu-emacs@gnu.org; Mon, 21 Jul 2014 19:56:13 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9NR5-0003gn-NT for bug-gnu-emacs@gnu.org; Mon, 21 Jul 2014 19:56:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X9NR4-0004yN-Ea; Mon, 21 Jul 2014 19:56:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <871ttg6rs2.fsf@maritornes.cs.unb.ca> Resent-From: Katsumi Yamaoka Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Mon, 21 Jul 2014 23:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18063 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.140598694219086 (code B ref -1); Mon, 21 Jul 2014 23:56:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Jul 2014 23:55:42 +0000 Original-Received: from localhost ([127.0.0.1]:33840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X9NQi-0004xj-2v for submit@debbugs.gnu.org; Mon, 21 Jul 2014 19:55:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54691) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X9NQf-0004xT-2S for submit@debbugs.gnu.org; Mon, 21 Jul 2014 19:55:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X9NQP-0003bC-C1 for submit@debbugs.gnu.org; Mon, 21 Jul 2014 19:55:31 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48924) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9NQP-0003b7-9C for submit@debbugs.gnu.org; Mon, 21 Jul 2014 19:55:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9NQH-0006Ph-OJ for bug-gnu-emacs@gnu.org; Mon, 21 Jul 2014 19:55:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X9NQA-0003Vf-80 for bug-gnu-emacs@gnu.org; Mon, 21 Jul 2014 19:55:13 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:59455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9NQA-0003RC-1L for bug-gnu-emacs@gnu.org; Mon, 21 Jul 2014 19:55:06 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X9NQ7-00037E-If for bug-gnu-emacs@gnu.org; Tue, 22 Jul 2014 01:55:03 +0200 Original-Received: from s70.gtokyofl21.vectant.ne.jp ([202.215.75.70]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Jul 2014 01:55:03 +0200 Original-Received: from yamaoka by s70.gtokyofl21.vectant.ne.jp with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Jul 2014 01:55:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 67 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: s70.gtokyofl21.vectant.ne.jp X-Face: #kKnN,xUnmKia.'[pp`; Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu; B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.130012 (=?UTF-8?Q?=E7=9C=9F?= Gnus v0.12) Emacs/24.4.50 (i686-pc-cygwin) Cancel-Lock: sha1:FExZBywiQZ53rFgANUAis60qaoM= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91734 Archived-At: --=-=-= On Sun, 20 Jul 2014 11:14:53 -0300, David Bremner wrote: > Hi Emacs Maintainers; Hi, Hmm, why has your original message not been accepted as a bug in the Emacs bug list? (I found it in the gmane.emacs.bugs newsgroup, so I'm cc'ing this to the group.) > A notmuch-emacs user reported a bug with emacs "hanging" on unpacking a > tar file. After some debugging I believe have narrowed the problem down > to the following test case, which can be run with e.g. > % emacs -Q --script bug.el > (require 'gnus-util) > (let* ((temp-dir (make-temp-file "/tmp/loop-test" t)) > (dir (concat temp-dir "/test")) > (target (concat dir "/parent"))) > (make-temp-file dir) > (make-directory dir) > (make-symbolic-link ".." target) > (message "%s" (gnus-recursive-directory-files dir))) > On my system, this reports some 40 spurious paths created by following > the symlink. In the actual case, it reported some 70,000 paths, which > caused further processing by the mm- libraries to grind to take an > apparently infinite time. The following patch fixes the problem at least on Cygwin. Is it ok for yours, too? If so, I'll install it in the Emacs trunk (i.e. the one that will become Emacs 24.5) and also the Gnus Git master. --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- gnus-util.el~ 2014-03-23 23:08:55.000000000 +0000 +++ gnus-util.el 2014-07-21 23:43:08.029233200 +0000 @@ -1910,7 +1910,7 @@ image))) image))) -(defun gnus-recursive-directory-files (dir) +(defun gnus-recursive-directory-files (dir &optional inodes) "Return all regular files below DIR." (let (files) (dolist (file (directory-files dir t)) @@ -1920,7 +1920,11 @@ ((file-regular-p file) (push file files)) ((file-directory-p file) - (setq files (append (gnus-recursive-directory-files file) files)))))) + (let ((inode (nth 10 (file-attributes file)))) + (unless (member inode inodes) + (setq files (append (gnus-recursive-directory-files + file (cons inode inodes)) + files)))))))) files)) (defun gnus-list-memq-of-list (elements list) --=-=-=--