Browse Source

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.
Jon Trulson 1 year ago
parent
commit
3300d665a0
3 changed files with 19 additions and 32 deletions
  1. 1 0
      cde/programs/dtksh/.gitignore
  2. 17 29
      cde/programs/dtksh/Makefile.am
  3. 1 3
      cde/programs/dtksh/dtkcmds.c

+ 1 - 0
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

+ 17 - 29
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

+ 1 - 3
cde/programs/dtksh/dtkcmds.c

@@ -71,8 +71,6 @@
 #include "xmcmds.h"
 #include <locale.h>
 
-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);
 }