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 03:43:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi Daniel,

On 03.01.2021 19:16, Daniel Martín wrote:

A couple of tests are failing for me on master and a BSD system (macOS):

2 unexpected results:
    FAILED  xref--xref-file-name-display-is-abs
    FAILED  xref--xref-file-name-display-is-relative-to-project-root

An extract of a test failure is

(list-elt 0 (arrays-of-different-length 25 24
"xref-resources//file1.txt" "xref-resources/file1.txt" first-mismatch-at
15))

The reason for the failure is that BSD 'find' sometimes outputs paths
with an extra '/', for example:

find /path/emacs/test/lisp/progmodes/xref-resources/ -type f \( -iname \* \)
/path/emacs/test/lisp/progmodes/xref-resources//file2.txt
/path/emacs/test/lisp/progmodes/xref-resources//file1.txt

(Note the trailing '/' in the first argument to 'find'.)

As I think this differs from GNU find but it's still a valid POSIX path,
I decided to make the tests more flexible.

I don't mind the proposed change to the tests, but if this is the only situation when the BSD find behaves differently, we could try to avoid it like this:

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index d2b5acd555..019c9a35bc 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1374,7 +1374,8 @@ 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))
+                                     (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]