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

From: David Caldwell <[email-masked]>
Date: Mon, 16 Jun 2025 15:08:46 -0700

On 6/16/25 2:16 AM, Eli Zaretskii wrote:
>> From: Przemysław Kryger <[email-masked]>
>> Cc: [email-masked], [email-masked], [email-masked]
>> Date: Mon, 16 Jun 2025 09:20:53 +0100
>>
>>
>>> I could consider this if otherwise "M-x man" is completely broken on
>>> macOS. Is it?
>>
>> It is. At least in my case.
> 
> 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?

I ran some tests on macOS VMs I have. I don't know which ones Emacs 
officially supports. macOS 11 and below were tested on an Intel VM, and 
12 and higher were on an M1 VM. I doubt that matters though.

*** sed test:

#!/bin/bash
echo octal; printf "\001\002" | sed -e '/[\o001-\o002]/d' | od -c
echo char;  printf "\001\002" | sed -e '/[[:cntrl:]]/d' | od -c

I got 3 types of outputs with this test:

1. macOS With gnu sed the:
octal
char

2. With older macOS sed:

octal
0000000  001 002  \n
0000003
char

3. With newer macOS sed:

octal
sed: 1: "/[\o001-\o002]/d
": RE error: invalid character range
char

*** Emacs 30.1 test: `M-x man RET ascii RET`

Results
=======

OS Version    Emacs  Sed
--------------------------
macOS 10.12   works  #2
macOS 10.14   works  #2
macOS 10.15   works  #2
macOS 11      works  #2
macOS 12      works  #2
macOS 13      works  #2
macOS 14      works  #2
macOS 15      fails  #3

The interesting thing is that even on the Emacs versions that work, the 
sed script isn't actually doing what it is supposed to do. So it's 
broken but just not in an immediately fatal way.

Even the earliest version I tested supported the `[:cntrl:]` notation so 
it seems that's a good fix for macOS 15 and will work on even very old 
macOS versions.

-David