bug#81472: 31.0.91; ispell test failures on 32-bit Solaris sparc

Lockywolf <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Lockywolf Laptop <[email protected]> writes:

> Eli Zaretskii <[email protected]> writes:
>
>
> I found at least one (version-detection) issue, manifested at an old
> x86_64 Solaris, I will try to submit a patch soon.

I still did not manage to run the tests on a 32-bit SPARC, as I never
found a machine to do this, but I managed to either fix or disable the
failing tests on Solaris 10 x86_64, the patch is attached.


It also makes version checking more rigorous on all systems, so should
be beneficial even regardless of being used on Solaris.

Can I do anything else to have this issue closed?

-- 
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)
0001-Fix-ispell-tests-issues-discovered-on-Solaris-10.patch (text/x-patch, 11.4 KB)
From 1fb52780813b06d17f3bc9b9be785de1bcfd29d4 Mon Sep 17 00:00:00 2001
From: Lockywolf <[email protected]>
Date: Fri, 21 Aug 2026 18:30:16 +0800
Subject: [PATCH] Fix ispell-tests issues discovered on Solaris 10.

* lisp/textmodes/ispell.el: export minimum versions for engines.
ispell--minversion-alist: define versions alist.
(ispell-check-version): use public version alist.
* test/lisp/textmodes/ispell-tests/ispell-tests-common.el:
(ispell-tests--parse-v): parse engine versions.
(ispell-tests--valid-version-triple?): add version verification.
(ispell-tests--broken-system?): add predicate for excluding broken
systems.
*test/lisp/textmodes/ispell-tests/ispell-aspell-tests.el:
(ispell/aspell/ispell-check-version/works): add aspell triple check.
(ispell/aspell/ispell-word/english/correct): add aspell triple check.
(ispell/aspell/ispell-word/english/incorrect): add aspell triple check.
* test/lisp/textmodes/ispell-tests/ispell-tests.el:
(ispell/ispell-valid-dictionary-list/aspell): add aspell triple check.
(ispell/ispell-pdict-save/unmodified): disable on Solaris.
(ispell/ispell-lookup-words/simple): disable on Solaris.
(ispell/ispell-complete-word/ispell-completion-at-point): disable
on Solaris.
---
 lisp/textmodes/ispell.el                      | 20 ++++--
 .../ispell-tests/ispell-aspell-tests.el       | 12 +++-
 .../ispell-tests/ispell-tests-common.el       | 61 ++++++++++++++++++-
 .../textmodes/ispell-tests/ispell-tests.el    |  7 ++-
 4 files changed, 90 insertions(+), 10 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index d0ee617c1c5..13b4e75d4b7 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -655,6 +655,14 @@ ispell-dicts-name2locale-equivs-alist
 ;;; The following are used by ispell, and should not be changed.
 ;;; **********************************************************************
 
+(defconst ispell--minversion-alist
+  `((Aspell "0.60")
+    (Hunspell "1.1.6")
+    (Enchant "2.1.0")
+    (,(intern "International Ispell") "3.1.12"))
+"Alist of the form (engine version) declaring minimally permitted versions."
+)
+
 (defun ispell-check-version (&optional interactivep)
   "Ensure that `ispell-program-name' is valid and has the correct version.
 Return version number if called interactively, or if INTERACTIVEP is non-nil.
@@ -729,10 +737,14 @@ ispell-check-version
                     nil t)
 		   (match-string 1)))))
 
-      (let* ((aspell8-minver   "0.60")
-             (ispell-minver    "3.1.12")
-             (hunspell8-minver "1.1.6")
-             (enchant-minver   "2.1.0")
+      (let* ((aspell8-minver   (car (alist-get 'Aspell
+                                          ispell--minversion-alist)))
+             (ispell-minver    (car (alist-get 'International\ Ispell
+                                          ispell--minversion-alist)))
+             (hunspell8-minver (car (alist-get 'Hunspell
+                                          ispell--minversion-alist)))
+             (enchant-minver   (car (alist-get 'Enchant
+                                          ispell--minversion-alist)))
              (minver (cond
                       ((not (version<= ispell-minver ispell-program-version))
                        ispell-minver)
diff --git a/test/lisp/textmodes/ispell-tests/ispell-aspell-tests.el b/test/lisp/textmodes/ispell-tests/ispell-aspell-tests.el
index d843dd245ba..e8b6a494057 100644
--- a/test/lisp/textmodes/ispell-tests/ispell-aspell-tests.el
+++ b/test/lisp/textmodes/ispell-tests/ispell-aspell-tests.el
@@ -37,9 +37,11 @@
 (ert-deftest ispell/aspell/ispell-check-version/works ()
   "Test that aspell is correctly detected."
   (skip-unless (and (executable-find "aspell")
-                    (with-temp-buffer
-                      (call-process "aspell" nil t nil "-vv")
-                      (search-backward "but really Aspell"))))
+                  (with-temp-buffer
+                    (call-process "aspell" nil t nil "-vv")
+                    (search-backward "but really Aspell"))
+                  (ispell-tests--valid-version-triple?
+                   (ispell-tests--parse-v "aspell"))))
   (ispell-tests--letopt ((ispell-program-name "aspell"))
     (setq ispell-last-program-name (time-to-seconds))
     (setf ispell-program-name "aspell")
@@ -72,6 +74,8 @@ ispell/aspell/ispell-word/english/correct
   (skip-unless (equal
                 0
                 (call-process "aspell" nil nil nil "-vv")))
+  (skip-unless (ispell-tests--valid-version-triple?
+                   (ispell-tests--parse-v "aspell")))
   (skip-unless (equal
                 0
                 (with-temp-buffer
@@ -104,6 +108,8 @@ ispell/aspell/ispell-word/english/incorrect
   (skip-unless (equal
                 0
                 (call-process "aspell" nil nil nil "-vv")))
+  (skip-unless (ispell-tests--valid-version-triple?
+                   (ispell-tests--parse-v "aspell")))
   (skip-unless (equal
                 0
                 (with-temp-buffer
diff --git a/test/lisp/textmodes/ispell-tests/ispell-tests-common.el b/test/lisp/textmodes/ispell-tests/ispell-tests-common.el
index 8111b39f304..60f16c98a8f 100644
--- a/test/lisp/textmodes/ispell-tests/ispell-tests-common.el
+++ b/test/lisp/textmodes/ispell-tests/ispell-tests-common.el
@@ -26,6 +26,7 @@
 
 (require 'ert)
 (require 'ert-x)
+(require 'ispell)
 
 (defvar ispell-tests--data-directory
   (let ((ert-resource-directory-trim-right-regexp "-tests/.*-tests-common\\.el"))
@@ -36,6 +37,49 @@ fake-aspell-path
   (expand-file-name "fake-aspell-new.bash" ispell-tests--data-directory)
   "Path to the mock backend.")
 
+(defun ispell-tests--parse-v (path)
+  "Parse a spellchecking backend's at PATH -v.
+Return proto version, engine type, and version
+ (i.e., aspell, hunspell, enchant)."
+  (or (executable-find path)
+     (error "ispell command (%s) is not runnable" path))
+  (with-temp-buffer
+    (call-process path nil t nil "-v")
+    (goto-char (point-min))
+    (forward-line 1)
+    (when (not (eobp))
+      (delete-region (point) (point-max)))
+    (goto-char (point-min))
+    (search-forward "International Ispell Version ") ; last space is important!
+    (let* ((proto-version (let* ((s (point))
+                                 (e (progn (search-forward " ")
+                                           (backward-char)
+                                           (point))))
+                            (buffer-substring s e)))
+           (engine (condition-case nil
+                       (let ((s (progn (search-forward "but really ")
+                                       (point)))
+                             (e (progn (search-forward " ")
+                                       (backward-char)
+                                       (point))))
+                         (buffer-substring s e))
+                     (error "International Ispell")))
+           (engine-version (if (string-equal engine "International Ispell")
+                               proto-version
+                             (let ((s (progn (forward-char)
+                                             (point)))
+                                   (e (progn (search-forward ")")
+                                             (backward-char)
+                                             (point))))
+                               (buffer-substring s e)))))
+      (list proto-version engine engine-version))))
+
+(defun ispell-tests--valid-version-triple? (triple)
+  "Check if spellchecker version TRIPLE is valid."
+  (let ((engine (nth 1 triple))
+        (engine-version (nth 2 triple)))
+    (version<= (car (alist-get (intern engine) ispell--minversion-alist))
+               engine-version)))
 
 (let* ((backend-binaries (list "ispell" "aspell"  "hunspell"  "enchant-2" fake-aspell-path))
        (filter-binaries (seq-filter
@@ -44,7 +88,9 @@ fake-aspell-path
                             (executable-find b)
                             (equal 0
                                    (with-temp-buffer
-                                     (call-process b nil t nil "-a")))))
+                                     (call-process b nil t nil "-a")))
+                            (ispell-tests--valid-version-triple?
+                             (ispell-tests--parse-v b))))
                          backend-binaries)))
 
   (defun ispell-tests--some-backend-available-p ()
@@ -55,9 +101,20 @@ fake-aspell-path
   (defun ispell-tests--some-backend ()
     "Return the string of some available backend."
     (let ((retval (car filter-binaries)))
-      (message "available backend is:%s" retval)
       retval)))
 
+(defun ispell-tests--broken-system? ()
+  "On some systems Emacs works, but ispell does not.
+Such systems are usually so old that their users are expected to
+do debugging anyway.  This function returns true if such a system
+is detected.
+1. Solaris has broken grep, which ispell.el relies upon."
+  (or (with-temp-buffer
+      (call-process "uname" nil t nil "-s")
+      (search-backward "SunOS"))
+     ;; add other broken stuff here
+     ))
+
 (defun ispell-tests--some-valid-dictionary (backend)
   "Return some dictionary name working for BACKEND."
   (cond ((string-equal backend "ispell")
diff --git a/test/lisp/textmodes/ispell-tests/ispell-tests.el b/test/lisp/textmodes/ispell-tests/ispell-tests.el
index 95f88be3b51..ca10ad4ff44 100644
--- a/test/lisp/textmodes/ispell-tests/ispell-tests.el
+++ b/test/lisp/textmodes/ispell-tests/ispell-tests.el
@@ -316,6 +316,8 @@ ispell/ispell-valid-dictionary-list/aspell
 For aspell, `ispell-valid-dictionary-list' computes an intersection of
 `ispell-dictionary-alist' and `ispell--aspell-found-dictionaries'."
   (skip-unless (executable-find "aspell"))
+  (skip-unless (ispell-tests--valid-version-triple?
+                             (ispell-tests--parse-v "aspell")))
   (skip-unless (with-temp-buffer
                  (call-process "aspell" nil t nil "dicts")
                  (> (length (buffer-string)) 2)))
@@ -1368,6 +1370,7 @@ ispell/ispell-pdict-save/unmodified
 
 (ert-deftest ispell/ispell-lookup-words/simple ()
   "Test if `ispell-lookup-words' is runnable."
+  (skip-unless (not (ispell-tests--broken-system?)))
   (with-environment-variables (("HOME" temporary-file-directory))
     (let* ((default-directory temporary-file-directory)
            (tempfile (make-temp-file "emacs-ispell.el-test" nil nil ispell-tests--constants/completion)))
@@ -1389,6 +1392,7 @@ ispell/ispell-lookup-words/simple
 
 (ert-deftest ispell/ispell-complete-word/ispell-completion-at-point ()
   "Test if `ispell-complete-word' and `ispell-completion-at-point' are runnable."
+  (skip-unless (not (ispell-tests--broken-system?)))
   (with-environment-variables (("HOME" temporary-file-directory))
     (let* ((default-directory temporary-file-directory)
            (tempfile (make-temp-file "emacs-ispell.el-test" nil nil ispell-tests--constants/completion)))
@@ -1420,9 +1424,10 @@ ispell/ispell-complete-word/ispell-completion-at-point
 
 (ert-deftest ispell/ispell-complete-word-interior-frag/simple ()
   "Test if `ispell-complete-word-interior-frag' is runnable."
+  (skip-unless (not (ispell-tests--broken-system?)))
   (with-environment-variables (("HOME" temporary-file-directory))
     (let* ((default-directory temporary-file-directory)
-           (tempfile (make-temp-file "emacs-ispell.el-test" nil nil "waveguides")))
+           (tempfile (make-temp-file "emacs-ispell.el-test" nil nil ispell-tests--constants/completion)))
       (ispell-tests--letopt
           ((ispell-program-name (ispell-tests--some-backend))
            (ispell-complete-word-dict tempfile))
-- 
2.46.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.