Subject: Re: bug#77944: 31.0.50; M-x man on macOS fails with error

From: Przemysław Kryger <[email-masked]>
Date: Mon, 16 Jun 2025 14:00:46 +0100

> Please disregard what I wrote about calling `(Man-init-defvars)'. [...]

Actually not.  I've double checked and Man-sed-command is evaluated
while Man-filter-list is set by Man-init-defvars.  It seems that calling
the latter is indeed required when Man-sed-command is updated after man
has been loaded.

> Can someone please provide a comprehensive answer to this: does "M-x
> man" always fail on all supported versions of macOS?  If not, which
> versions are affected?

It fails with Emacs 30.1 on macOS Sequoia 15.5:

emacs -Q

M-x man RET sed RET

fails with (as in original report):

sed: 1: "/^[\o001-\o032][\o001-\ ...": RE error: invalid character range

In the *scratch* evaluated the following, just to make sure there are no
differences between effective PATH if make-process and a terminal:

emacs-version
   "30.1"
(executable-find "sed")
=> "/usr/bin/sed"
(shell-command-to-string (concat (executable-find "sed") " --version"))
=> "/usr/bin/sed: illegal option -- -
   usage: sed script [-EHalnru] [-i extension] [file ...]
      sed [-EHalnu] [-i extension] [-e script] ... [-f script_file] ... [file ...]
   "

So it seems that the "/usr/bin/sed" is unable to process --version
argument, while:

(shell-command-to-string (concat (executable-find "gsed") " --version"))
=> "/opt/homebrew/bin/gsed (GNU sed) 4.9
   Copyright (C) 2022 Free Software Foundation, Inc.
   License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
   This is free software: you are free to change and redistribute it.
   There is NO WARRANTY, to the extent permitted by law.

   Written by Jay Fenlason, Tom Lord, Ken Pizzini,
   Paolo Bonzini, Jim Meyering, and Assaf Gordon.

   This sed program was built without SELinux support.

   GNU sed home page: <https://www.gnu.org/software/sed/>.
   General help using GNU software: <https://www.gnu.org/gethelp/>.
   E-mail bug reports to: <[email-masked]>."