emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix some failing tests in BSD systems


From: Dmitry Gutov
Subject: Re: [PATCH] Fix some failing tests in BSD systems
Date: Mon, 4 Jan 2021 19:10:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 04.01.2021 17:52, Eli Zaretskii wrote:
The changes you are referring to are both in the test code. There's
nothing inherently wrong in using concat in such code, as long as we
test what we want to test.

There's nothing wrong with that, sure, but you risk false failures due
to issues like the one here.  However, if you are okay with that, I
don't mind.  It just was strange to see such code.

It's a matter of the interpretation. For one, if I saw this behavior with GNU find (which is installed on my machine), I'd want to fix it rather than just update the test.

No harm in doing that just for BSD find either.

If you actually meant to suggest an alternative comparison strategy
(like in Daniel's latest patch), then I think the test becomes
unnecessarily lax. After all, we want to also check how the string
"looks" (because the user will see it verbatim), not just what file it
points at.

I don't think you can reliably know how the file name will be
formatted by a particular variety of 'find', not IME.  But I'm not
going to argue about this.

I think we can try.

The fact that we've only seen such a report now is a good indicator.

So, Daniel, how does the patch below work for you? It should also fix the same behavior in dired-do-find-regexp.

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index d417382c0d..a87f054146 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -291,7 +291,8 @@ project--files-in-directory
          (localdir (file-local-name (expand-file-name dir)))
          (command (format "%s %s %s -type f %s -print0"
                           find-program
-                          localdir
+                          ;; Omit the / for BSD find's sake.
+                          (directory-file-name localdir)
                           (xref--find-ignores-arguments ignores localdir)
                           (if files
                               (concat (shell-quote-argument "(")
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index d2b5acd555..32efc2807c 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1374,7 +1374,9 @@ xref-matches-in-directory
        ;; do that reliably enough, without creating false negatives?
        (command (xref--rgrep-command (xref--regexp-to-extended regexp)
                                      files
- (file-local-name (expand-file-name dir))
+                                     ;; Omit the / for BSD find's sake.
+                                     (directory-file-name
+ (file-local-name (expand-file-name dir)))
                                      ignores))
        (def default-directory)
        (buf (get-buffer-create " *xref-grep*"))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]