From: Philipp <p.stephani2@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 48471@debbugs.gnu.org
Subject: bug#48471: 28.0.50; Incorrect handling of `project-ignores' on macOS (BSD find?) if project root is a directory name
Date: Mon, 17 May 2021 21:37:42 +0200 [thread overview]
Message-ID: <53E1AC7F-1D49-4845-8DF6-4CB24BC15E6A@gmail.com> (raw)
In-Reply-To: <7f9e984c-bea9-f55f-526a-680a9bb3f66b@yandex.ru>
> Am 17.05.2021 um 02:23 schrieb Dmitry Gutov <dgutov@yandex.ru>:
>
> Hi!
>
> On 16.05.2021 23:05, Philipp wrote:
>> To work around this, XRef should probably only pass directory file names
>> to find, not directory names, at least on macOS.
>
> Could you track down the piece of code that's misbehaving? Maybe with a little edebug-ing.
>
> I don't have any BSD find at hand, but
>
> (xref--find-ignores-arguments '("./bar") "/tmp/foo/")
>
> returns
>
> "\\( -path /tmp/foo/bar \\) -prune -o "
>
> here.
Yes, and that's the problem. macOS find compares the "-path" value against /tmp/foo//bar (note the double slash), and that doesn't match. The exact shell command generated by project--files-in-directory is:
find /tmp/foo/ \( -path /tmp/foo/bar \) -prune -o -type f -print0
And that doesn't work on macOS:
$ find /tmp/foo/ \( -path /tmp/foo/bar \) -prune -o -type f -print
/tmp/foo//baz
/tmp/foo//bar
This needs to be either "find /tmp/foo ..." (no trailing slash) or "-path /tmp/foo//bar" (double slash). However, the latter than fails with GNU find:
$ gfind /tmp/foo/ \( -path /tmp/foo//bar \) -prune -o -type f -print
/tmp/foo/baz
/tmp/foo/bar
So probably it's better to use the former option. That works with both both macOS find and GNU find:
$ find /tmp/foo \( -path /tmp/foo/bar \) -prune -o -type f -print
/tmp/foo/baz
$ gfind /tmp/foo \( -path /tmp/foo/bar \) -prune -o -type f -print
/tmp/foo/baz
There's a comment in project--files-in-directory ";; In case DIR is a symlink." Probably the command should use the -H option instead.
>
> Also, your return value of (project-files 'foo) seems to indicate that you're using the version of project.el that doesn't include the commit 665b4e7c4e093391a353506e7b2385f0902db70b. Please see if it fixed this problem as well.
This was a build from yesterday, it should definitely include that commit.
next prev parent reply other threads:[~2021-05-17 19:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-16 20:05 bug#48471: 28.0.50; Incorrect handling of `project-ignores' on macOS (BSD find?) if project root is a directory name Philipp
2021-05-17 0:23 ` Dmitry Gutov
2021-05-17 19:37 ` Philipp [this message]
2021-05-17 20:02 ` Philipp
2021-05-17 23:06 ` Dmitry Gutov
2021-05-23 11:08 ` Philipp
2021-05-29 21:44 ` Dmitry Gutov
2021-05-30 4:29 ` Lars Ingebrigtsen
2021-05-30 11:13 ` Dmitry Gutov
2021-05-31 5:33 ` Lars Ingebrigtsen
2021-05-30 6:31 ` Eli Zaretskii
2021-05-30 11:14 ` Dmitry Gutov
2021-05-30 16:27 ` Paul Eggert
2021-05-30 16:36 ` Eli Zaretskii
2021-06-07 1:58 ` Dmitry Gutov
2021-06-07 8:51 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-07 18:48 ` Philipp
[not found] ` <ff528f00-ac80-4a84-fafb-076896793930@yandex.ru>
2021-10-09 22:14 ` Paul Eggert
[not found] ` <4de8fa95-e8f3-d07f-2f0c-8b06feff7190@cs.ucla.edu>
2021-10-09 22:29 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53E1AC7F-1D49-4845-8DF6-4CB24BC15E6A@gmail.com \
--to=p.stephani2@gmail.com \
--cc=48471@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).