From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: locate-dominating-file calls `stat' too eagerly Date: Mon, 29 Sep 2008 16:45:22 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1222721153 6965 80.91.229.12 (29 Sep 2008 20:45:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Sep 2008 20:45:53 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 29 22:46:51 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KkPdo-0000GQ-2q for ged-emacs-devel@m.gmane.org; Mon, 29 Sep 2008 22:46:48 +0200 Original-Received: from localhost ([127.0.0.1]:51898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkPck-00038e-Uq for ged-emacs-devel@m.gmane.org; Mon, 29 Sep 2008 16:45:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KkPcg-00036z-15 for emacs-devel@gnu.org; Mon, 29 Sep 2008 16:45:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KkPce-00035j-FW for emacs-devel@gnu.org; Mon, 29 Sep 2008 16:45:37 -0400 Original-Received: from [199.232.76.173] (port=42694 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkPce-00035b-Bi for emacs-devel@gnu.org; Mon, 29 Sep 2008 16:45:36 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:40077) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KkPcS-0005SM-PO; Mon, 29 Sep 2008 16:45:25 -0400 Original-Received: from alfajor.home (vpn-132-204-232-228.acd.umontreal.ca [132.204.232.228]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id m8TKjrOi020303; Mon, 29 Sep 2008 16:45:54 -0400 Original-Received: by alfajor.home (Postfix, from userid 20848) id 271D71C18F; Mon, 29 Sep 2008 16:45:22 -0400 (EDT) In-Reply-To: (Eli Zaretskii's message of "Mon, 29 Sep 2008 22:05:04 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3114=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:104233 Archived-At: >> > (defun locate-dominating-file (file regexp) >> > "Look up the directory hierarchy from FILE for a file matching REGEXP." >> > ;; If FILE does not exist, find its parent directory that does. >> > (or (file-exists-p file) >> > (while (and file (not (file-directory-p file))) >> > (setq file (file-name-directory (directory-file-name file))))) >> In some corner cases, this can infloop. > What are those cases? I think we need to describe them in a comment > there. Can't remember, sadly. >> > And btw, won't the user test cover the case of crossing ~/ as well? >> In 99% of the cases, yes. > What are the remaining 1%? Again, I think they should be mentioned in > comments. These are too obvious to be worth mentioning: when the user owns ~/.. The most common such case I can think of is when the user is `root'. Stefan