From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66542: Fix: locate-dominating-file predicate should receive dir not file Date: Wed, 25 Oct 2023 16:15:56 +0300 Message-ID: <834jiekflf.fsf@gnu.org> References: <83mswlqka5.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16705"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66542-done@debbugs.gnu.org To: dalanicolai Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 25 15:17:16 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qvdl6-00049g-4o for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Oct 2023 15:17:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvdkt-00024B-PN; Wed, 25 Oct 2023 09:17:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvdkP-0001wS-VV for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 09:16:40 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvdkP-0004w0-J8 for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 09:16:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qvdks-0007is-ET for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 09:17:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Oct 2023 13:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 66542 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 66542@debbugs.gnu.org, eliz@gnu.org, dalanicolai@gmail.com Original-Received: via spool by 66542-done@debbugs.gnu.org id=D66542.169823979729635 (code D ref 66542); Wed, 25 Oct 2023 13:17:02 +0000 Original-Received: (at 66542-done) by debbugs.gnu.org; 25 Oct 2023 13:16:37 +0000 Original-Received: from localhost ([127.0.0.1]:57707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvdkS-0007hv-UO for submit@debbugs.gnu.org; Wed, 25 Oct 2023 09:16:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvdkP-0007hV-96 for 66542-done@debbugs.gnu.org; Wed, 25 Oct 2023 09:16:34 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvdjo-0004pT-5R; Wed, 25 Oct 2023 09:15:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+mXUfepdCb4HcqW9/I90oJKn5g9qT384QTqOlel2cq4=; b=QEg1ClT5bVr8 grpXw1s1kHLoKbWEd4eGBueYtltH4pOvO/eHSYO2qMbfnqjh0xK+9I+dL17L+mKJNRuZ0Q74aagjp u75k2IF5aWzgwS6+e6nkEa1PDY6qK6e6+BxYdQm4SOrHmkgxV3Fj4zI/K4uI6NMRTKcZK3/IPoAPQ mDzY15+t6J72NsmegYJCJe9rE7fL6vz3aCkGtJTprl/hKDXlYF/8/Qwps2cQnnOPfBFZ7gw5cOzK7 t7CTvJrjj3d0j5lOOQbkQvaRLQTYB9GvXk74kpQiTghMMf0RP8brBC8AMguybHdBLx1TcndXzBzTt 0IuGROUkhXIwMXyB/dvfDg==; In-Reply-To: (message from dalanicolai on Sat, 21 Oct 2023 17:39:17 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273173 Archived-At: > From: dalanicolai > Date: Sat, 21 Oct 2023 17:39:17 +0200 > Cc: 66542@debbugs.gnu.org > > You are right (of course :) > So I have attached another patch which only strips the file name (applies file-name-directory) if the file > is not a directory. > > If the file is not a directory, then that stripped name should also be returned by the function, i.e. in the > 'cond`, root should be set to the stripped file name. Therefore, the patched version simply 'checks > and sets' the file name first inside the setq. > > Also, now we can remove the check in the first clause of the 'if' (of 'setq try'), because 'file' is > guaranteed to be a directory name, and the existence of the directory name is already checked by > the 'file-exists-p'. > > This change does not affect other parts of the function (except that it speeds it up a little, because it > excludes the cycles, that only strip the file names in case file is a 'real' file. > Indeed, the function should only check for 'parent directories' (not files). Thanks, installed on master, and closing the bug.