GNU bug report logs - #25534
26.0; xref ERT tests fail when the source path is mixed case

Previous Next

Package: emacs;

Reported by: Wilfred Hughes <me <at> wilfred.me.uk>

Date: Wed, 25 Jan 2017 22:00:02 UTC

Severity: normal

Merged with 27880

Found in versions 25.2, 26.0

Fixed in version 26.2

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Rob Browning <rlb <at> defaultvalue.org>
Subject: bug#27880: closed (Re: bug#25534: 26.0; xref ERT tests fail when
 the source path is mixed case)
Date: Wed, 19 Dec 2018 02:22:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#25534: 25.2; elisp-mode-tests may downcase too aggressively

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 27880 <at> debbugs.gnu.org.

-- 
25534: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25534
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Glenn Morris <rgm <at> gnu.org>
To: 25534-done <at> debbugs.gnu.org
Subject: Re: bug#25534: 26.0;
 xref ERT tests fail when the source path is mixed case
Date: Tue, 18 Dec 2018 21:21:32 -0500
Version: 26.2

In an effort to reduce the number of distropatches in Debian, specifically

https://sources.debian.org/patches/emacs/1:26.1+1-1/0008-Don-t-downcase-real-xref-in-elisp-mode-tests.patch/

I have applied the following:

commit 4c6c327
Date:   Tue Dec 18 21:18:31 2018 -0500

    Restrict downcasing in elisp xref tests (bug#25534)
    
    The tests happen to not fail at the moment because find-library-name
    now has an extra feature, find-library--from-load-history, which
    happens to do a case-insensitive regexp match; but still it seems
    better not to rely on this.
    
    * test/lisp/progmodes/elisp-mode-tests.el (xref--case-insensitive):
    New variable.
    (xref-elisp-test-run, emacs-test-dir): Only downcase if the
    filesystem seems to be case-insensitive.

diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el
index 941e85b..97148ef 100644
--- a/test/lisp/progmodes/elisp-mode-tests.el
+++ b/test/lisp/progmodes/elisp-mode-tests.el
@@ -298,6 +298,16 @@ xref-elisp-test-descr-to-target
       )))
 
 
+;; tmp may be on a different filesystem to the tests, but, ehh.
+(defvar xref--case-insensitive
+  (let ((dir (make-temp-file "xref-test" t)))
+    (unwind-protect
+        (progn
+          (with-temp-file (expand-file-name "hElLo" dir) "hello")
+          (file-exists-p (expand-file-name "HELLO" dir)))
+      (delete-directory dir t)))
+  "Non-nil if file system seems to be case-insensitive.")
+
 (defun xref-elisp-test-run (xrefs expected-xrefs)
   (should (= (length xrefs) (length expected-xrefs)))
   (while xrefs
@@ -307,11 +317,13 @@ xref-elisp-test-run
            (expected-source (when (consp expected) (cdr expected))))
 
       ;; Downcase the filenames for case-insensitive file systems.
-      (setf (xref-elisp-location-file (oref xref location))
-            (downcase (xref-elisp-location-file (oref xref location))))
+      (when xref--case-insensitive
+        (setf (xref-elisp-location-file (oref xref location))
+              (downcase (xref-elisp-location-file (oref xref location))))
 
-      (setf (xref-elisp-location-file (oref expected-xref location))
-            (downcase (xref-elisp-location-file (oref expected-xref location))))
+        (setf (xref-elisp-location-file (oref expected-xref location))
+              (downcase (xref-elisp-location-file
+                         (oref expected-xref location)))))
 
       (should (equal xref expected-xref))
 
@@ -346,10 +358,10 @@ xref-elisp-deftest
 ;; `load-path' has the correct case, so this causes the expected test
 ;; values to have the wrong case). This is handled in
 ;; `xref-elisp-test-run'.
-(defconst emacs-test-dir
-  (downcase
-   (file-truename (file-name-directory
-		   (or load-file-name (buffer-file-name))))))
+(defvar emacs-test-dir
+  (funcall (if xref--case-insensitive 'downcase 'identity)
+           (file-truename (file-name-directory
+                           (or load-file-name (buffer-file-name))))))
 
 
 ;; alphabetical by test name

[Message part 3 (message/rfc822, inline)]
From: Rob Browning <rlb <at> defaultvalue.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2; elisp-mode-tests may downcase too aggressively
Date: Sun, 30 Jul 2017 11:21:40 -0500
[Refiling as a bug report from a list thread.]

It looks like (in 25.2, and perhaps master too) elisp-mode-tests.el
downcases the xref path (location) for comparison in
xref-elisp-test-run, but that seems to also affect the filesystem lookup
lower down (in xref--goto-location) such that a handful of tests fail if
the build path contains uppercase characters.  i.e. it tries to read the
downcased path, which of course (on ext4) doesn't exist.

In any case, I've hacked up a temporary fix by keeping the original as
"real-xref" and cloning that (and copying the location) to produce the
xref used by the modification and comparison.

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



This bug report was last modified 6 years and 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.