From 8b6ba69fd80aece5e5326c7ee596b77c546abcd5 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 15 Jan 2026 17:02:38 -0500 Subject: [PATCH] linux.370 hints: validate sysconf GDBPATH With sys/unix/hints/linux.370, if GDBPATH doesn't exist, comment out the GDBPATH line in sysconf during 'make install' or 'make update'. [ macOS apparently uses sys/unix/hints/macosx.sh to do its sysconf manipulation, so there is no corresponding change for sys/unix/hints/macOS.370 ] Closes #1477 --- sys/unix/Makefile.top | 2 ++ sys/unix/hints/linux.370 | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index af0a966ef..c108f3552 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -440,6 +440,8 @@ update: $(PRECHECK) $(GAME) recover $(VARDAT) spec_levs sys/unix/sysconf touch $(VARDIR)/perm $(VARDIR)/record # sysconf, but only if it does not exist true; $(SYSCONFENSURE) +# other steps from hints file + true; $(POSTUPDATE) # and a reminder @echo You may also want to install the man pages via the doc Makefile. diff --git a/sys/unix/hints/linux.370 b/sys/unix/hints/linux.370 index 4f49e9921..3ceb7cda3 100755 --- a/sys/unix/hints/linux.370 +++ b/sys/unix/hints/linux.370 @@ -390,13 +390,15 @@ endif #?WANT_SOURCE_INSTALL INSTDIR=$(HACKDIR) VARDIR = $(HACKDIR) -ifneq "$(CCISCLANG)" "" -# gdb may not be installed if clang is chosen compiler so the game -# won't start in that case due to a sysconf error. Comment out -# relevant lines in sysconf. -POSTINSTALL+= sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \ +ifdef MAKEFILE_TOP +TESTGDBPATH=/usr/bin/gdb +POSTINSTALL+= test -f $(TESTGDBPATH) || \ + sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \ -e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf; -endif +POSTUPDATE+= test -f $(TESTGDBPATH) || \ + sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \ + -e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf; +endif #MAKEFILE_TOP ifeq '$(USE_NONOSTATICFN)' '1' CFLAGS += -DNONOSTATICFN