Subject: [REGRESSION] Removal of gnuopt in 4.9

From: "Osipov, Michael (IN IT IN)" <[email-masked]>
Date: Mon, 21 Aug 2023 12:28:27 +0200

Folks,

apologies, the previous mail went to the wrong list since I wanted to 
report a bug.

While trying to build 4.9 on HP-UX 11.31 the compiler tells me that 
gnuopt.h is missing. Last year 4.8 just worked obviously. It was removed 
in 71de42fd346688b131e7364d7ea7be4e973fb0c3 [1] because it is 
deprecated, this I understand. What I don't understand is why it was not 
replaced with getopt-gnu? The removal commit [2] in gnulib says:
> +2020-04-27  getopt          This deprecated module is removed. Please choose
> +                            among getopt-posix and getopt-gnu. getopt-gnu
> +                            provides "long options" and "options with optional
> +                            arguments", getopt-posix doesn't.

and getopt depends on getopt-gnu.

I have added getopt-gnu to bootstrap.conf and lib/getopt.c to 
po/POTFILES.in, ran the bootstrap machinery on my BSD box and produced 
sed-4.9-dirty.tar.gz. This compiled flawlessly on HP-UX, ran tests:
> ============================================================================
> Testsuite summary for GNU sed 4.9-dirty
> ============================================================================
> # TOTAL: 68
> # PASS:  53
> # SKIP:  14
> # XFAIL: 0
> # FAIL:  1
> # XPASS: 0
> # ERROR: 0

as well as the binary itself:
> # /opt/ports/bin/sed --version
> /opt/ports/bin/sed (GNU sed) 4.9-dirty
> # file /opt/ports/bin/sed
> /opt/ports/bin/sed:     ELF-32 executable object file - IA64

Can someone explain why it was removed without a replacement which can 
break people's builds? Ideally re-added with a non-deprecated module?

Working patch: [3]

Best regards,

Michael

[1] 
https://github.com/mirror/sed/commit/71de42fd346688b131e7364d7ea7be4e973fb0c3
[2] https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=0abc38bd2a1398f0
[3] 
https://github.com/mirror/sed/compare/master...michael-o:sed:v4.9-with-getopt-gnu