emacs-31 7b0f33cb741: Backport: Use default exec-suffixes when needed (bug#81280, bug#81517)
Michael Albinus via Mailing list for Emacs changes <[email protected]> Thu, 30 Jul 2026 07:14:08 -0400 (EDT)
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: emacs-31 commit 7b0f33cb741f632da4336c3939677770e68b2ca8 Author: Michael Albinus <[email protected]> Commit: Michael Albinus <[email protected]> Backport: Use default exec-suffixes when needed (bug#81280, bug#81517) * lisp/files.el (executable-find): Use (default-value 'exec-suffixes). * src/callproc.c (Qexec_suffixes): Declare. (call_process): * src/process.c (Fmake_process): Use Fdefault_value (Qexec_suffixes). * test/lisp/files-x-tests.el (files-x-test--variables6): New defconst. (files-x-test-connection-local-special-variables): New test. (cherry picked from commit dcdd76f89e77421bf8be4ae0c2324b3029a23f1a) --- lisp/files.el | 2 +- src/callproc.c | 3 ++- src/process.c | 2 +- test/lisp/files-x-tests.el | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 9b1fc09fcfa..7bebf765db2 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1331,7 +1331,7 @@ remote, otherwise search locally." ;; Use 1 rather than file-executable-p to better match the ;; behavior of call-process. (let ((default-directory (file-name-quote default-directory 'top))) - (locate-file command exec-path exec-suffixes 1)))) + (locate-file command exec-path (default-value 'exec-suffixes) 1)))) (declare-function read-library-name "find-func" nil) diff --git a/src/callproc.c b/src/callproc.c index 52977b29f30..7eb245f915c 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -520,7 +520,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, { int ok; - ok = openp (Vexec_path, args[0], Vexec_suffixes, &path, + ok = openp (Vexec_path, args[0], Fdefault_value (Qexec_suffixes), &path, make_fixnum (X_OK), false, false, NULL); if (ok < 0) report_file_error ("Searching for program", args[0]); @@ -2258,4 +2258,5 @@ multiple times on subsequent partitions of the list of arguments. DEFSYM (Qafter_insert_file_set_buffer_file_coding_system, "after-insert-file-set-buffer-file-coding-system"); DEFSYM (Qcoding_system_for_write, "coding-system-for-write"); + DEFSYM (Qexec_suffixes, "exec-suffixes"); } diff --git a/src/process.c b/src/process.c index 3a14f60b3c2..383e56d5bb8 100644 --- a/src/process.c +++ b/src/process.c @@ -2032,7 +2032,7 @@ usage: (make-process &rest ARGS) */) && IS_DEVICE_SEP (SREF (program, 1)))) { tem = Qnil; - openp (Vexec_path, program, Vexec_suffixes, &tem, + openp (Vexec_path, program, Fdefault_value (Qexec_suffixes), &tem, make_fixnum (X_OK), false, false, NULL); if (NILP (tem)) report_file_error ("Searching for program", program); diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el index 88e02ba143c..31633df073e 100644 --- a/test/lisp/files-x-tests.el +++ b/test/lisp/files-x-tests.el @@ -39,6 +39,9 @@ (defconst files-x-test--variables5 '((remote-lazy-var . nil) (remote-null-device . "/dev/null"))) +(defconst files-x-test--variables6 + '((exec-suffixes . ("foo")) + (path-separator . "foo"))) (defvar remote-shell-file-name) (defvar remote-null-device) (defvar remote-lazy-var nil) @@ -601,5 +604,39 @@ If it's not initialized yet, initialize it." `(connection-local-profile-alist ',clpa now) `(connection-local-criteria-alist ',clca now)))) +(ert-deftest files-x-test-connection-local-special-variables () + "Test special local variables. +The connection-local variables `exec-suffixes' and `path-separator' are +used for remote processes. When calling `call-process', `make-process' +or `executable-find', their default value must be used nonetheless." + + (let ((clpa connection-local-profile-alist) + (clca connection-local-criteria-alist) + (program (file-name-sans-extension + (file-name-concat invocation-directory invocation-name))) + proc) + (connection-local-set-profile-variables + 'special-variables files-x-test--variables6) + (connection-local-set-profiles + nil 'special-variables) + + (unwind-protect + (with-temp-buffer + (let ((enable-connection-local-variables t)) + (hack-connection-local-variables-apply nil) + (should (zerop (call-process program nil nil nil "--help"))) + (should + (processp + (setq proc + (make-process + :name invocation-name :command `(,program "--help"))))) + (should (executable-find program)))) + + ;; Cleanup. + (when (processp proc) (kill-process proc)) + (custom-set-variables + `(connection-local-profile-alist ',clpa now) + `(connection-local-criteria-alist ',clca now))))) + (provide 'files-x-tests) ;;; files-x-tests.el ends here