GNU bug report logs -
#78882
stty.c compilation error
Previous Next
To reply to this bug, email your comments to 78882 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#78882
; Package
coreutils
.
(Mon, 23 Jun 2025 21:15:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Bruno Haible <bruno <at> clisp.org>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Mon, 23 Jun 2025 21:15:05 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
The coreutils CI fails today on OpenBSD and Solaris. (The previous build,
a week ago, succeeded.)
Compilation error on OpenBSD:
cc -I. -I.. -I./lib -Ilib -I../lib -Isrc -I../src -I/usr/local/include -Wall -Wno-format-extra-args -Wno-implicit-const-int-float-conversion -Wno-tautological-constant-out-of-range-compare -g -O2 -MT src/stty.o -MD -MP -MF $depbase.Tpo -c -o src/stty.o ../src/stty.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ../src/stty.c:2177:
src/speedlist.h:156:4: error: unterminated conditional directive
# ifdef B4000000n case 4000000: return B4000000;n# endif
^
src/speedlist.h:155:4: error: unterminated conditional directive
# ifdef B3500000n case 3500000: return B3500000;n# endif
^
...
Compilation error on Solaris 11.4:
gcc -m64 -I. -I.. -I./lib -Ilib -I../lib -Isrc -I../src -Wall -D_REENTRANT -g -O2 -MT src/stty.o -MD -MP -MF $depbase.Tpo -c -o src/stty.o ../src/stty.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ../src/stty.c:2177:
src/speedlist.h: In function ‘baud_to_value’:
src/speedlist.h:60:19: warning: extra tokens at end of #ifdef directive
60 | # ifdef B0n case B0: return 0;n# endif
| ^~~~
src/speedlist.h:156: error: unterminated #ifdef
156 | # ifdef B4000000n case 4000000: return B4000000;n# endif
src/speedlist.h:155: error: unterminated #ifdef
...
It looks like the 'speedgen' script, added in commit
357fda90d15fd3f7dba61e1ab322b183a48d0081, produces this invalid C code.
With GNU sed:
$ echo 100 | sed -e 's/^.*$/# ifdef B&\n case B&: return &;\n# endif/'
# ifdef B100
case B100: return 100;
# endif
With OpenBSD sed and Solaris sed:
$ echo 100 | sed -e 's/^.*$/# ifdef B&\n case B&: return &;\n# endif/'
# ifdef B100n case B100: return 100;n# endif
The attached patch fixes it.
[0001-build-Fix-compilation-error-on-OpenBSD-and-Solaris.patch (text/x-patch, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#78882
; Package
coreutils
.
(Mon, 23 Jun 2025 21:29:03 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi Bruno,
Bruno Haible via GNU coreutils Bug Reports <bug-coreutils <at> gnu.org>
writes:
> It looks like the 'speedgen' script, added in commit
> 357fda90d15fd3f7dba61e1ab322b183a48d0081, produces this invalid C code.
>
> With GNU sed:
>
> $ echo 100 | sed -e 's/^.*$/# ifdef B&\n case B&: return &;\n# endif/'
> # ifdef B100
> case B100: return 100;
> # endif
>
> With OpenBSD sed and Solaris sed:
>
> $ echo 100 | sed -e 's/^.*$/# ifdef B&\n case B&: return &;\n# endif/'
> # ifdef B100n case B100: return 100;n# endif
>
> The attached patch fixes it.
Good catch, I fixed something similar in git a few weeks ago [1]. From
the commit message:
The OpenBSD 'sed' command does not support '\n' to represent newlines in
sed expressions. This leads to the follow compiler error:
In file included from builtin/help.c:15:
./config-list.h:282:18: error: use of undeclared identifier 'n'
"gitcvs.dbUser",n "gitcvs.dbPass",
^
1 error generated.
gmake: *** [Makefile:2821: builtin/help.o] Error 1
Perhaps it is worth documenting somewhere? I think Autoconf's manual has
a section of shell portability gotchas.
Collin
[1] https://github.com/git/git/commit/db170e18262ed10e5e9b7f3cbca6a0ac43267b20
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#78882
; Package
coreutils
.
(Mon, 23 Jun 2025 21:29:05 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#78882
; Package
coreutils
.
(Mon, 23 Jun 2025 21:59:06 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
H. Peter Anvin wrote:
> Do the shells on these systems support $'\n' constants?
Sure. Dollar-single-quote strings in sh are quote portable.
> There is also the option of simply putting a newline in the string, I
> believe.
The best way to include a newline in a sed script is not to use a
literal newline directly, but rather to use backslash-newline,
and start a new -e argument for the second line. [1][2]
But this is, IMO, an inordinate amount of workarounds, for using
'sed' on an input file that contains a list of numbers, one per line.
It's better to put the 'sed' script in a separate file and invoke
sed with one '-f' option instead of with several '-e' options.
Another maintainable approach, which does not require a separate
file, is the simple 'while' loop in the patch that I'm proposing.
Bruno
[1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/sed.html
[2] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Limitations-of-Usual-Tools.html
Reply sent
to
Pádraig Brady <P <at> draigBrady.com>
:
You have taken responsibility.
(Mon, 23 Jun 2025 22:01:06 GMT)
Full text and
rfc822 format available.
Notification sent
to
Bruno Haible <bruno <at> clisp.org>
:
bug acknowledged by developer.
(Mon, 23 Jun 2025 22:01:06 GMT)
Full text and
rfc822 format available.
Message #19 received at 78882-done <at> debbugs.gnu.org (full text, mbox):
On 23/06/2025 22:14, Bruno Haible via GNU coreutils Bug Reports wrote:
> Hi,
>
> The coreutils CI fails today on OpenBSD and Solaris. (The previous build,
> a week ago, succeeded.)
> With OpenBSD sed and Solaris sed:
>
> $ echo 100 | sed -e 's/^.*$/# ifdef B&\n case B&: return &;\n# endif/'
> # ifdef B100n case B100: return 100;n# endif
>
> The attached patch fixes it.
Applied.
Marking this as done.
thanks!
Padraig
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#78882
; Package
coreutils
.
(Mon, 23 Jun 2025 22:02:04 GMT)
Full text and
rfc822 format available.
Message #22 received at submit <at> debbugs.gnu.org (full text, mbox):
Collin Funk wrote:
> Perhaps it is worth documenting somewhere? I think Autoconf's manual has
> a section of shell portability gotchas.
Yes, I had the same thought. Done through
<https://lists.gnu.org/archive/html/autoconf-patches/2025-06/msg00001.html>.
Bruno
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#78882
; Package
coreutils
.
(Mon, 23 Jun 2025 22:02:06 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#78882
; Package
coreutils
.
(Tue, 24 Jun 2025 00:28:02 GMT)
Full text and
rfc822 format available.
Message #28 received at submit <at> debbugs.gnu.org (full text, mbox):
Bruno Haible <bruno <at> clisp.org> writes:
> Yes, I had the same thought. Done through
> <https://lists.gnu.org/archive/html/autoconf-patches/2025-06/msg00001.html>.
Thanks! That looks good.
Collin
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#78882
; Package
coreutils
.
(Tue, 24 Jun 2025 00:28:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#78882
; Package
coreutils
.
(Tue, 24 Jun 2025 07:22:02 GMT)
Full text and
rfc822 format available.
Message #34 received at submit <at> debbugs.gnu.org (full text, mbox):
On 2025-06-23 14:14, Bruno Haible wrote:
>
> The coreutils CI fails today on OpenBSD and Solaris. (The previous build,
> a week ago, succeeded.)
>
Do the shells on these systems support $'\n' constants?
There is also the option of simply putting a newline in the string, I
believe.
-hpa
This bug report was last modified 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.