[bug #68146] build.sh: segfault on macOS when $(wildcard) matches files
anonymous <[email protected]> Wed, 11 Mar 2026 19:22:21 -0400 (EDT)
| Newsgroups | gmane.comp.gnu.make.bugs |
|---|---|
| Message-ID | <[email protected]> |
--8323329-846930886-1773271341=:4126863
Content-Type: TEXT/plain; CHARSET=utf-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-Disposition: inline
URL:=0A <https://savannah.gnu.org/bugs/?68146>=0A=0A Summa=
ry: build.sh: segfault on macOS when $(wildcard) matches=0Afiles=0A =
Group: make=0A Submitter: None=0A Su=
bmitted: Wed 11 Mar 2026 11:22:16 PM UTC=0A Severity: 3 - No=
rmal=0A Priority: 5 - Normal=0A Item Group: Bug=
=0A Status: None=0A Privacy: Public=0A =
Assigned to: None=0A Open/Closed: Open=0A Disc=
ussion Lock: Unlocked=0A Component Version: 4.4.1=0A Operating=
System: None=0A Fixed Release: None=0A Triage Status: =
None=0A=0A=0A _______________________________________________________=0A=
=0AFollow-up Comments:=0A=0A=0A--------------------------------------------=
-----------=0ADate: Wed 11 Mar 2026 11:22:16 PM UTC By: Anonymous=0A GNU M=
ake 4.4.1 built via build.sh on macOS segfaults when a Makefile=0A uses $(=
wildcard) and the pattern matches at least one file. Builds via=0A ./confi=
gure && make are not affected. Versions 4.3 and 4.4 are not=0A affected ei=
ther.=0A=0A Steps to reproduce:=0A 1. Extract make-4.4.1.tar.gz on macO=
S=0A 2. ./configure --without-guile && ./build.sh=0A 3. mkdir /tmp/te=
st && touch /tmp/test/foo.c /tmp/test/bar.c=0A 4. cat > /tmp/test/Makefi=
le <<'EOF'=0A SOURCES =3D $(wildcard *.c)=0A all:=0A @ec=
ho "$(SOURCES)"=0A EOF=0A 5. ./make -C /tmp/test=0A=0A Expected: =
prints "bar.c foo.c"=0A Actual: Segmentation fault=0A=0A Root cause:=0A =
configure correctly detects that macOS lacks a compatible GNU glob and=0A =
sets USE_SYSTEM_GLOB=3Dno. GNU Make's own glob implementation is compiled=
=0A into lib/libgnu.a. However, build.sh links with:=0A=0A $CC $CFLAGS =
$LDFLAGS -L"$OUTLIB" -o "$OUTDIR/makenew$EXEEXT" $objs -lgnu=0A=0A On macO=
S, libSystem.B.dylib is always implicitly linked and exports its=0A own gl=
ob(). Since -lgnu is a static archive, the linker only pulls in=0A symbols=
that are currently undefined. By the time it processes -lgnu,=0A glob() i=
s already resolved from libSystem. The system glob_t struct has=0A a diffe=
rent layout than GNU glob_t, causing a segfault in glob_in_dir().=0A=0A Co=
nfirmed with nm:=0A - Broken (build.sh 4.4.1): U _glob (from libSy=
stem)=0A - Working (build.sh 4.3/4.4): T _glob (internal)=0A - Wor=
king (configure+make 4.4.1): T _glob (internal)=0A=0A Patch attached. It =
uses -Wl,-force_load on macOS to ensure all symbols=0A from libgnu.a are l=
oaded, so GNU Make's internal glob() takes precedence.=0A=0A Environment:=
=0A macOS 15.3 (Sequoia), Apple Clang 17, arm64=0A=0A=0A=0A=0A=0A=0A =
_______________________________________________________=0AFile Attachments:=
=0A=0AName: make-4.4.1-macos-glob.patch Size: 2.4KiB=0A=0A<https://file.=
savannah.gnu.org/file/make-4.4.1-macos-glob.patch?file_id=3D58345>=0A=0A=0A=
=0A AGPL NOTICE=0A=0AThese attachments are served by Savane. You can dow=
nload the corresponding=0Asource code of Savane at=0Ahttps://savannah.gnu.o=
rg/source/savane-5479f0ac3e1f014845fd281c379bc3ccb7a72723.tar.gz=0A=0A _=
______________________________________________________=0A=0AReply to this i=
tem at:=0A=0A <https://savannah.gnu.org/bugs/?68146>=0A=0A________________=
_______________________________=0AMessage sent via Savannah=0Ahttps://savan=
nah.gnu.org/=0A
--8323329-846930886-1773271341=:4126863
Content-Type: APPLICATION/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCabH5LQAKCRCqLAuaBUf3
Tpk2AQCnPTFqd4XLGl7MxdnbboKNt1RAreYhaA3rzXTODYTQXQD8CUPnsdq+38VK
SlNs9g64QG490rKQRzKSg3cklA7WAgo=
=Lp4u
-----END PGP SIGNATURE-----
--8323329-846930886-1773271341=:4126863--