From 3300d665a097c8921d69c67f33527c1033c32d1a Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Sat, 27 Aug 2022 17:22:18 -0600 Subject: [PATCH] Upgrade ksh93 to 1.0.3 This commit upgrades ksh93 to the latest version. Some minor changes were required in the dtkcmds.c to make this work. Most of the changes were in Makefile.am - primarily ensuring that SHOPTS_* defines matched between dtksh and ksh93 builds, and that ksh93 was actually told about them :) The SHOPTS_* defines need to be assigned as the integer 1 as well, or various preprocessor checks in ksh93 would fail. Also: - got rid of SUIDEXECDEFINES - this is a holdover from the Imake days and was never defined anyway. - removed some SHOPT_* defines that no longer existed. - do not pass CFLAGS to the ksh build at all - no need to complicate things. --- cde/programs/dtksh/.gitignore | 1 + cde/programs/dtksh/Makefile.am | 46 +++++++++++++--------------------- cde/programs/dtksh/dtkcmds.c | 4 +-- 3 files changed, 19 insertions(+), 32 deletions(-) diff --git a/cde/programs/dtksh/.gitignore b/cde/programs/dtksh/.gitignore index 8b374e56a..2b5f9fddf 100644 --- a/cde/programs/dtksh/.gitignore +++ b/cde/programs/dtksh/.gitignore @@ -47,6 +47,7 @@ ksh93/src/cmd/INIT/w.req ksh93/src/cmd/builtin/FEATURE/ ksh93/src/cmd/builtin/pty ksh93/src/cmd/ksh93/FEATURE/ +ksh93/src/cmd/ksh93/shopt.h ksh93/src/cmd/ksh93/ksh ksh93/src/cmd/ksh93/shcomp ksh93/src/cmd/ksh93/shell.req diff --git a/cde/programs/dtksh/Makefile.am b/cde/programs/dtksh/Makefile.am index 3d71f6566..5fa956579 100644 --- a/cde/programs/dtksh/Makefile.am +++ b/cde/programs/dtksh/Makefile.am @@ -16,16 +16,23 @@ bin_PROGRAMS = dtksh BUILT_SOURCES = init.c +# Put all SHOPT definitions here. It is vital that dtksh and ksh93 +# are built with the same options. We pass this list to both the +# dtksh components and to the ksh93 build as well. They must be +# specifically assigned a 1 or various preprocessor checks (#if SHOPT +# ...) in ksh93 will fail. +KSH93_SHOPTS = -DSHOPT_DYNAMIC=1 -DSHOPT_NAMESPACE=1 -DSHOPT_MULTIBYTE=1 \ + -DSHOPT_STATS=1 -DSHOPT_BGX=1 -DSHOPT_AUDIT=1 \ + -DSHOPT_KIA=1 -DSHOPT_HISTEXPAND=1 -DSHOPT_EDPREDICT=1 \ + -DSHOPT_ESH=1 -DSHOPT_VSH=1 -DSHOPT_FIXEDARRAY=1 -DSHOPT_SUID_EXEC=1 \ + -DSHOPT_BRACEPAT=1 + dtksh_CPPFLAGS = -I$(KSH93SRC)/include/ast -I$(KSH93SRC)/src/cmd/ksh93/include \ -I$(KSH93SRC)/src/cmd/ksh93 -I${srcdir}/lib/DtPrint \ - -I${srcdir}/lib/DtHelp -Iksh93/src/cmd/ksh93/FEATURE \ - '-DAST_VERSION=20111111' -DSHOPT_STATS -DSHOPT_NAMESPACE \ - -DSHOPT_2DMATCH -DSHOPT_MULTIBYTE -DSHOPT_BGX -DSHOPT_AUDIT \ - -D_PACKAGE_ast -DSHOPT_DYNAMIC -D_BLD_shell -DSHOPT_KIA \ - -DKSHELL -DSHOPT_HISTEXPAND -DSHOPT_EDPREDICT -DSHOPT_ESH \ - -DSHOPT_VSH -DSHOPT_FIXEDARRAY \ - '-DERROR_CONTEXT_T=Error_context_t' -DSHOPT_SUID_EXEC \ - -D_API_ast=20100309 -DSHOPT_BRACEPAT -DBUILD_DTKSH + -I${srcdir}/lib/DtHelp $(KSH93_SHOPTS) \ + -D_PACKAGE_ast -DKSHELL \ + '-DERROR_CONTEXT_T=Error_context_t' \ + -D_API_ast=20100309 -DBUILD_DTKSH dtksh_LDADD = $(DTCLIENTLIBS) ksh93/src/cmd/ksh93/pmain.o $(XTOOLLIB) \ libshell.a $(KSH93SRC)/lib/libcmd.a $(KSH93SRC)/lib/libast.a \ @@ -51,27 +58,8 @@ dtksh_SOURCES = init.c \ extra.c \ msgs.c -# for the BSD's we do not want to pass CFLAGS since it includes a -# -I/usr/local/incude directive. This breaks ksh's iconv -# detection due to the weird way in which iconv seems to be handled on -# the BSD's - both a libc impl (preferred), and a possibly external -# GNU iconv impl installed in /usr/local. -# -# /usr/local/include is added to CFLAGS by the X11/Motif detection -# logic - since that is where all of the needed headers are on the -# BSDs. -# -# So until/unless that is fixed in ksh93, we will avoid sending -# anything to the ksh build system except for SUIDEXECDEFINES - -if BSD -KSH93_CCFLAGS=$(SUIDEXECDEFINES) -else -KSH93_CCFLAGS=$(CFLAGS) $(SUIDEXECDEFINES) -endif - ksh93/bin/ksh: - ksh93/bin/package flat make CCFLAGS='$(KSH93_CCFLAGS)' + ksh93/bin/package flat make CCFLAGS='$(KSH93_SHOPTS)' init.c: ksh93/bin/ksh $(CP) ksh93/src/cmd/ksh93/sh/init.c ./ @@ -82,7 +70,7 @@ libshell.a: $(KSH93SLIBSHELL) dtksh-init.o $(AR) cq libshell.a dtksh-init.o check-local: - ./dtksh -c true && ksh93/bin/shtests --posix --utf8 SHELL=.libs/lt-dtksh + ./dtksh -c true && ksh93/bin/shtests --posix --utf8 SHELL=.libs/dtksh clean-local: ksh93/bin/package clean diff --git a/cde/programs/dtksh/dtkcmds.c b/cde/programs/dtksh/dtkcmds.c index 13b1c56f5..48d547fa7 100644 --- a/cde/programs/dtksh/dtkcmds.c +++ b/cde/programs/dtksh/dtkcmds.c @@ -71,8 +71,6 @@ #include "xmcmds.h" #include -extern Namval_t *sh_assignok(Namval_t *np,int add); - static void PendingDestroy( Widget w, @@ -7120,7 +7118,7 @@ GetNameValuePair( * As long as we clean up the original, I don't think we leak here. */ if(sh.subshell) - np2 = sh_assignok(np2, 1); + sh_assignok(np2, 1); } return(np2); }