From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dalanicolai Newsgroups: gmane.emacs.bugs Subject: bug#66542: Fix: locate-dominating-file predicate should receive dir not file Date: Thu, 26 Oct 2023 15:27:54 +0200 Message-ID: References: <83mswlqka5.fsf@gnu.org> <834jiekflf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000088135806089e8b20" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32749"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66542-done@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 26 15:29: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 1qw0QG-0008Ez-8Q for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Oct 2023 15:29:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qw0Pz-000061-H0; Thu, 26 Oct 2023 09:28:59 -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 1qw0PY-0008RW-P2 for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 09:28:32 -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 1qw0PX-0000Ct-TU for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 09:28:32 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qw0Q2-0007nG-Kt for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 09:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Oct 2023 13:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66542 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66542-done@debbugs.gnu.org id=D66542.169832694129947 (code D ref 66542); Thu, 26 Oct 2023 13:29:02 +0000 Original-Received: (at 66542-done) by debbugs.gnu.org; 26 Oct 2023 13:29:01 +0000 Original-Received: from localhost ([127.0.0.1]:32772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qw0Q0-0007mt-UZ for submit@debbugs.gnu.org; Thu, 26 Oct 2023 09:29:01 -0400 Original-Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:54327) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qw0Pw-0007mX-AU for 66542-done@debbugs.gnu.org; Thu, 26 Oct 2023 09:29:00 -0400 Original-Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-408425c7c10so7586495e9.0 for <66542-done@debbugs.gnu.org>; Thu, 26 Oct 2023 06:28:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698326899; x=1698931699; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=evgvPkrKIYYY1wQf4SqofEtv+7iLyqK0cPajMF5kaAk=; b=KHTd7bZieyzd/YoaZcZe4jQ7yZU1jyCDXQjTboWCM4wzB5Urj2W5z7YgIkulJR7wOQ rV36B8QUEopgSS8b82onr+yA+wfnDDYImdPxaGrbcHgWUoBX1WoaiN102SRtxlykw13L 54GxNIGZclAcGM2ILIyajI1wgrfdQOwxXGFc4O67Yb9sN1LidHNloVEx8xyWgK7OBjwC mh0B5KcKPo2fnCgMdwSLCgCdfKbkIzWw4uKG+FSOTqH6gkiBBFpQh7sEB3oUcLY3gLXp oopXNe/earLpXENeOA9vQeKUl83DfiKY5YySuywKNq4BbR239Y1qktIOXsO/LQZ6/fzU tbWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698326899; x=1698931699; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=evgvPkrKIYYY1wQf4SqofEtv+7iLyqK0cPajMF5kaAk=; b=MpglJGyacIor7HMsAbVroR6wBvi67VgizLDp4ArrQ7wDIF/LdlZoQEmqxabKp/QABo AcoMwHZ7OtVA829vB5S3xw9/xN86QGVHR/2d1qW5Yi9K5WljVbsXc4lBnkeLJIeOf9DC cF1kKp2+t66BqwM8c8qaOU63+rFhEoUN15Lmn7trkJCZ3d6EFyvJMim/Zx/qVlDzzk44 0R31bR99FPv5or81k5ZA1fl2C6w5ue9LJt2ysSNuGJqONFD/p/PKL5nnR4JHIC04I9IE KqKwIW66/Bgcs5oZrh0CNiWGy4Bk5akyzCOfZfmXAyPW37WtWwwwmQku57L+E0OrHa/r Rc5g== X-Gm-Message-State: AOJu0YzeLXv3hJbuONV1p3ZiMLlyL+nYp3cOMN1jiZteijxCclA4hbN7 fEqHLibFZD1IhlwoNuaa+Q+Vqz6OEo/6e2j/71bBcNEf X-Google-Smtp-Source: AGHT+IGOr+zrMrNDDOOTSbiGM2fCZh8LGnU2gN5QZI2UyidP6yF0LKN5r5KEcViOZ0hHKd01ZT+smzwVtgdnM8/r3Qs= X-Received: by 2002:a05:600c:5254:b0:405:3dd0:6ee9 with SMTP id fc20-20020a05600c525400b004053dd06ee9mr14008972wmb.34.1698326899068; Thu, 26 Oct 2023 06:28:19 -0700 (PDT) In-Reply-To: <834jiekflf.fsf@gnu.org> 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:273286 Archived-At: --00000000000088135806089e8b20 Content-Type: text/plain; charset="UTF-8" Thank you Eli! On Wed, 25 Oct 2023 at 15:15, Eli Zaretskii wrote: > > 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. > --00000000000088135806089e8b20 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you Eli!

On Wed, 25 Oct 2023 at 15:15, Eli Zarets= kii <eliz@gnu.org> wrote:
> From: dalanicolai = <dalanicolai@= gmail.com>
> Date: Sat, 21 Oct 2023 17:39:17 +0200
> Cc: 66542@d= ebbugs.gnu.org
>
> You are right (of course :)
> So I have attached another patch which only strips the file name (appl= ies 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, t= he 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&#= 39; (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 i= t 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.
--00000000000088135806089e8b20--