NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/58092: nbsed dumped core during buildworld



The following reply was made to PR bin/58092; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/58092: nbsed dumped core during buildworld
Date: Mon, 30 Dec 2024 07:02:38 +0000 (UTC)

 On Sat, 30 Mar 2024, rwhitlock22%gmail.com@localhost wrote:
 
 >> Description:
 > I was doing a "make buildworld" and nbsed dumped core. Here is the last of the output from make:
 >
 > dependall ===> external/mit/xorg/share/nls/am_ET.UTF-8
 > #    create  am_ET.UTF-8/Compose.ct
 > rm -f Compose.ct
 > /usr/src_netbsd-10/tooldir/bin/x86_64--netbsd-cpp -undef -traditional  < /usr/src_netbsd-10/xsrc/external/mit/libX11/dist/nls/am_ET.UTF-8/Compose.pre | /usr/src_netbsd-10/tooldir/bin/nbsed    -e '/^#  *[0-9][0-9]*  *.*$/d'  -e '/^#line  *[0-9][0-9]*  *.*$/d'  -e '/^[     ]*XCOMM$/s/XCOMM/#/'  -e '/^[   ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/#/'  -e '/^[       ]*XHASH/s/XHASH/#/'  -e '/\@\@$/s/\@\@$/\\/' > Compose.ct
 > [1]   Done                    /usr/src_netbsd-10/tooldir/bin/x86_64--netbsd-... |
 >      Segmentation fault (core dumped) /usr/src_netbsd-10/tooldir/bin/nbsed -e "/^#  ...
 > *** Error code 139
 >
 > Stop.
 >
 
 This is a regex(3) bug and to provoke it you need these conditions:
 
 1. a UTF-8 locale.
 2. regex(3) routines compiled w/o `-DNLS' (like the tools build).
 3. Non-ASCII input.
 
 A standalone reproducer is:
 
 ```
 #!/bin/sh
 
 set -eu
 
 # Set any UTF-8 locale to provoke crash.
 #
 export LANG=en_GB.UTF-8
 
 # Compile regex(3) without `-DNLS' like the tools build.
 #
 cc	-DHAVE_NBTOOL_COMPAT_H=1 \
  	-I/usr/src/include \
  	-I/usr/src/tools/compat \
  	-I/usr/tools/include/compat \
  	-ggdb -o sed \
  	/usr/src/usr.bin/sed/*.c \
  	/usr/src/lib/libc/regex/reg*.c
 
 IF=/usr/xsrc/external/mit/libX11/dist/nls/am_ET.UTF-8/Compose.pre
 
 < "$IF" > /dev/null \
 ./sed \
  	-e '/^#  *[0-9][0-9]*  *.*$/d' \
  	-e '/^[[:blank:]]*XCOMM/s/XCOMM/#/'
 ```
 
 The patch here seems to fix this:
 
 https://mail-index.netbsd.org/tech-userlevel/2024/12/10/msg014620.html
 
 -RVP
 


Home | Main Index | Thread Index | Old Index