From e8cb7801252c1f6fdad152c0530bc2960a102d3e Mon Sep 17 00:00:00 2001 From: Ulrich Wilkens Date: Tue, 26 Mar 2013 04:08:13 +0100 Subject: [PATCH 1/4] Build dtksh on more OSs --- cde/programs/Imakefile | 2 +- cde/programs/dtksh/Imakefile | 9 ++++----- cde/programs/dtksh/ksh93/Imakefile | 2 +- cde/programs/dtksh/ksh93/ship/shipiffe.sh | 2 +- cde/programs/dtksh/ksh93/src/lib/libast/comp/conf.tab | 4 ++++ cde/programs/dtksh/ksh93/src/lib/libast/conf.tab | 4 ++++ cde/programs/dtksh/ksh93/src/lib/libast/features/lib | 4 ++-- cde/programs/dtksh/ksh93/src/lib/libast/features/tty | 2 ++ cde/programs/dtksh/ksh93/src/lib/libast/include/ast.h | 8 ++++++++ .../dtksh/ksh93/src/lib/libast/include/ast_std.h | 2 ++ cde/programs/dtksh/ksh93/src/lib/libast/include/sfio.h | 2 ++ cde/programs/dtksh/ksh93/src/lib/libast/sfio/sfvprintf.c | 2 +- cde/programs/dtksh/ksh93/src/lib/libcmd/features/symlink | 9 ++++++++- 13 files changed, 40 insertions(+), 12 deletions(-) diff --git a/cde/programs/Imakefile b/cde/programs/Imakefile index f628ce31b..b04800fc7 100644 --- a/cde/programs/Imakefile +++ b/cde/programs/Imakefile @@ -10,7 +10,7 @@ EXTRADIRS = types localized tttypes $(NSGMLSDIR) util XCOMM some of these cannot be built on linux yet. XCOMM dtksh dtinfo #if defined(LinuxArchitecture) -DTKSHDIR = +DTKSHDIR = dtksh DTINFODIR = DTCMDIR = dtcm DTLOGINDIR = dtlogin diff --git a/cde/programs/dtksh/Imakefile b/cde/programs/dtksh/Imakefile index f5071a305..b20ae7a2d 100644 --- a/cde/programs/dtksh/Imakefile +++ b/cde/programs/dtksh/Imakefile @@ -61,16 +61,15 @@ EXTRA_INCLUDES = -I$(DTHELPSRC) -I$(DTPRINTSRC) .NO_PARALLEL: #endif +#ifdef LinuxArchitecture +SYS_LIBRARIES = -lm -ldl +#endif + #define IHaveSubdirs #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' -#if defined(LinuxArchitecture) -SUBDIRS = examples -KSH93OBJ = -#else SUBDIRS = examples ksh93 KSH93OBJ = $(KSH93SRC)/ksh93.o -#endif MakeSubdirs($(SUBDIRS)) diff --git a/cde/programs/dtksh/ksh93/Imakefile b/cde/programs/dtksh/ksh93/Imakefile index 9e1003281..3677918c5 100644 --- a/cde/programs/dtksh/ksh93/Imakefile +++ b/cde/programs/dtksh/ksh93/Imakefile @@ -56,7 +56,7 @@ ALL_SUBS = * ksh93src: $(RM) $(SHIP_DIR)/$(ALL_SUBS)/$(ALL_SUBS)/BUILT; \ - SHELL=$(KORNSHELL) CC=$(CC) CCFLAGS="$(CCFLAGS)" $(KORNSHELL) ship/shipin $(FORCE_SHIP) + SHELL=$(KORNSHELL) CC="$(CC)" CCFLAGS="$(CCFLAGS)" $(KORNSHELL) ship/shipin $(FORCE_SHIP) ksh93.o: $(OBJS) $(LD) -r -o $@ $(OBJS) diff --git a/cde/programs/dtksh/ksh93/ship/shipiffe.sh b/cde/programs/dtksh/ksh93/ship/shipiffe.sh index 41a10a61a..a4439802c 100644 --- a/cde/programs/dtksh/ksh93/ship/shipiffe.sh +++ b/cde/programs/dtksh/ksh93/ship/shipiffe.sh @@ -1103,7 +1103,7 @@ $inc *) e='-e /[\\\\/]sys[\\\\/]'$x'\.h"/d' ;; esac if $cc -E $tmp.c <&$nullin >$tmp.i - then i=`sed -e '/^#[line ]*[0-9][0-9]*[ ][ ]*"[\\\\/].*[\\\\/]'$x'\.h"/!d' $e -e s'/.*"\(.*\)".*/\1/' -e 's,\\\\,/,g' -e 's,///*,/,g' $tmp.i | sort -u` + then i=`sed -e '/^#[line ]*[0-9][0-9]*[ ][ ]*"[\\\\/].*[\\\\/]'$x'\.h"/!d' $e -e '/\/bits\//d' -e s'/.*"\(.*\)".*/\1/' -e 's,\\\\,/,g' -e 's,///*,/,g' $tmp.i | sort -u` for i in $i do break done diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/comp/conf.tab b/cde/programs/dtksh/ksh93/src/lib/libast/comp/conf.tab index b63580f8f..90f87ade9 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/comp/conf.tab +++ b/cde/programs/dtksh/ksh93/src/lib/libast/comp/conf.tab @@ -235,7 +235,11 @@ OPEN_MAX_CEIL 50 AST XX 1 L OPEN_MAX OS_VERSION 119 AES SC 1 FSU PAGESIZE 51 POSIX SC 1 L PAGE_SIZE 4096 #if _lib_getpagesize + #if defined(linux) + extern int getpagesize(void); + #else extern ssize_t getpagesize(void); + #endif #define _LOCAL_PAGESIZE getpagesize() #endif PAGE_SIZE 101 XOPEN SC 1 L PAGESIZE diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/conf.tab b/cde/programs/dtksh/ksh93/src/lib/libast/conf.tab index 394908e64..e3edc0d91 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/conf.tab +++ b/cde/programs/dtksh/ksh93/src/lib/libast/conf.tab @@ -239,7 +239,11 @@ OPEN_MAX_CEIL 50 AST XX 1 L OPEN_MAX OS_VERSION 119 AES SC 1 FSU PAGESIZE 51 POSIX SC 1 L PAGE_SIZE 4096 #if _lib_getpagesize + #if defined(linux) + extern int getpagesize(void); + #else extern ssize_t getpagesize(void); + #endif #define _LOCAL_PAGESIZE getpagesize() #endif PAGE_SIZE 101 XOPEN SC 1 L PAGESIZE diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/features/lib b/cde/programs/dtksh/ksh93/src/lib/libast/features/lib index 3c5d508b2..bbe2725bd 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/features/lib +++ b/cde/programs/dtksh/ksh93/src/lib/libast/features/lib @@ -5,10 +5,10 @@ lib _cleanup,BSDsetpgrp,atexit,bcopy,bzero,confstr,dirread,dup2,fchmod lib fcntl,fnmatch,fork,fsync,getconf,getdents,getdirentries,getdtablesize lib getgroups,getpagesize,getrlimit,getuniverse,index,killpg,link lib localeconv,lstat,mbtowc,memccpy -lib memchr,memcmp,memcpy,memdup,memmove,memset,mkdir,mkfifo,mknod,mktemp +lib memchr,memcmp,memcpy,memmove,memset,mkdir,mkfifo,mknod,mktemp lib mount,on_exit,onexit,opendir,pathconf,readlink,remove,rename,rindex lib rmdir,rewinddir,setlocale,setpgid,setpgrp,setpgrp2,setreuid,setsid -lib setuid,sigaction,sigprocmask,sigsetmask,sigunblock,sigvec +lib setuid,sigaction,sigprocmask,sigsetmask,sigvec lib socketpair,spawnve,spawnveg,strchr,strcoll,strdup,strerror,strrchr lib strtod,strtol,strtoul,strxfrm,symlink,sysconf lib telldir,tmpnam,tzset,universe,unlink,utime,vfork diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/features/tty b/cde/programs/dtksh/ksh93/src/lib/libast/features/tty index fa55870f8..9a75fc8aa 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/features/tty +++ b/cde/programs/dtksh/ksh93/src/lib/libast/features/tty @@ -16,5 +16,7 @@ cat{ #else #undef ioctl #endif + #if !defined(linux) extern int ioctl(int, int, ...); + #endif }end diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/include/ast.h b/cde/programs/dtksh/ksh93/src/lib/libast/include/ast.h index 11bad2b08..ffe0b39ce 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/include/ast.h +++ b/cde/programs/dtksh/ksh93/src/lib/libast/include/ast.h @@ -121,9 +121,17 @@ * workaround botched headers that assume */ +#if defined(linux) +#ifndef __FILE +#define __FILE FILE +#endif +#endif + +#if !defined(CSRG_BASED) #ifndef FILE #define FILE Sfio_t #endif +#endif /* * exit() support -- this matches shell exit codes diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/include/ast_std.h b/cde/programs/dtksh/ksh93/src/lib/libast/include/ast_std.h index e11431c65..0835df572 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/include/ast_std.h +++ b/cde/programs/dtksh/ksh93/src/lib/libast/include/ast_std.h @@ -137,7 +137,9 @@ #define _SKIP_SFSTDIO_H #else #define _SFSTDIO_H +#if !defined(linux) #define FILE int +#endif #if defined(__STDPP__directive) && defined(__STDPP__hide) #if !_std_def_calloc __STDPP__directive pragma pp:hide calloc diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/include/sfio.h b/cde/programs/dtksh/ksh93/src/lib/libast/include/sfio.h index e51c07315..1176f2fd7 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/include/sfio.h +++ b/cde/programs/dtksh/ksh93/src/lib/libast/include/sfio.h @@ -149,9 +149,11 @@ #define _STDIO_INCLUDED 1 #endif +#if !defined(CSRG_BASED) #ifndef FILE #define FILE Sfio_t #endif +#endif #endif /* __cplusplus */ typedef struct _sfio_ Sfile_t, Sfio_t, SFIO; diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/sfio/sfvprintf.c b/cde/programs/dtksh/ksh93/src/lib/libast/sfio/sfvprintf.c index 214bb50ee..7ec0b9107 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/sfio/sfvprintf.c +++ b/cde/programs/dtksh/ksh93/src/lib/libast/sfio/sfvprintf.c @@ -301,7 +301,7 @@ loop_fa : GETARG(form,form,argf,args,char*,char*,'1',t_user,n_user); if(!form) form = ""; -#if defined(CSRG_BASED) && !defined(__LP64__) +#if (defined(CSRG_BASED) && !defined(__LP64__)) || (defined(linux) && !defined(__LP64__)) GETARG(argsp,argsp,argf,args,va_list*,va_list*,'2',t_user,n_user); memcpy((Void_t*)(&(fa->args)), (Void_t*)(&args), sizeof(va_list)); memcpy((Void_t*)(&args), (Void_t*)argsp, sizeof(va_list)); diff --git a/cde/programs/dtksh/ksh93/src/lib/libcmd/features/symlink b/cde/programs/dtksh/ksh93/src/lib/libcmd/features/symlink index 6d054b84e..2c2ceb6e4 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libcmd/features/symlink +++ b/cde/programs/dtksh/ksh93/src/lib/libcmd/features/symlink @@ -1 +1,8 @@ -lib lchmod,lchown +lib lchown +tst lib_lchmod note{ lchmod() in default lib(s) }end link{ + #include + main() + { lchmod("/tmp/lchmod_test", 0755); + return 0; + } +}end From 86e5dc1f108d3cb8d8a4c339061a0316f9772a12 Mon Sep 17 00:00:00 2001 From: alx Date: Tue, 2 Apr 2013 22:44:14 +0200 Subject: [PATCH 2/4] Fixed dtpad server crash when closing editor window associated with primary document --- cde/programs/dtpad/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cde/programs/dtpad/main.c b/cde/programs/dtpad/main.c index 402e688e5..ff18cf716 100644 --- a/cde/programs/dtpad/main.c +++ b/cde/programs/dtpad/main.c @@ -633,6 +633,11 @@ CreateFirstPad( initialServerResources = pPad->xrdb; initialServerResources.server = False; /* so window will be mapped */ initialServerGeometry = pPad->geometry; + if(pPad->xrdb.workspaceList) + pPad->xrdb.workspaceList = strdup(pPad->xrdb.workspaceList); + if(pPad->xrdb.session) + pPad->xrdb.session = strdup(pPad->xrdb.session); + pPad->geometry = strdup(pPad->geometry); } /* Set some initial Editor instance values */ @@ -1677,7 +1682,6 @@ RestoreInitialServerResources( XtFree(pPad->geometry ); pPad->xrdb = initialServerResources; - pPad->geometry = initialServerGeometry; /* -----> duplicate resource strings */ if (initialServerResources.workspaceList != (char *)NULL) From a198d898e86d9950bbe87cd22df06eecee1709e1 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Fri, 17 May 2013 16:16:17 -0600 Subject: [PATCH 3/4] TT RPC server: Don't search 538 million transients trying to allocate one. Currently, mp_rpc_server.C tries 538 million ports to acquire an available transient rpcbind port number. This is bad when rpcbind is running in secure mode (and you are not using tirpc) - Xsession will 'hang' at the dthello (blue) screen filling up your error logs with RPC errors. Now, just try +- 50 (for a total of 100 ports) before bailing. The dthello 'blue screen of death' is the most common problem in starting CDE when rpcbind isn't set up properly. This should at least not cause the appearance of a 'hang'. --- cde/lib/tt/slib/mp_rpc_server.C | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cde/lib/tt/slib/mp_rpc_server.C b/cde/lib/tt/slib/mp_rpc_server.C index 1ed95468c..8292c86f6 100644 --- a/cde/lib/tt/slib/mp_rpc_server.C +++ b/cde/lib/tt/slib/mp_rpc_server.C @@ -417,8 +417,19 @@ gettransient(int proto, int vers, int *sockp) // if you try to grab a number for udp and we have it grabbed // for tcp). - // search up in the range 0x4fffffff - 0x5fffffff - for (prognum = 0x4fffffff; prognum <= 0x5fffffff; prognum++) { + // JET - this is way too many pnums to search, and causes what + // appears to be an infinite loop (though it isn't) if the + // user is running an rpcbind in secure mode and not using + // libtirpc - a common error. The end result is staring at + // the dthello welcome screen. So - rather than search this + // immense space, we will only search from start to +-50 + // before bailing. If a hundred attmepts to get a transient + // fail, I don't see that doing approximately 537 million + // attempts are worth it :) +#define MAX_TRANS_RANGE 50 + + // search up in the range 0x4fffffff to 0x4fffffff + MAX_TRANS_RANGE + for (prognum = 0x4fffffff; prognum <= (0x4fffffff + MAX_TRANS_RANGE); prognum++) { /* XXX: pmap_set allows the same prognum for different */ /* protocols so we hack around that by attemptint to */ /* set both tcp and udp. */ @@ -447,7 +458,7 @@ gettransient(int proto, int vers, int *sockp) } // search down in the range 0x4ffffffe - 0x40000000 - for (prognum = 0x4ffffffe; prognum >= 0x40000000; prognum--) { + for (prognum = 0x4ffffffe; prognum >= (0x4ffffffe - MAX_TRANS_RANGE); prognum--) { /* XXX: pmap_set allows the same prognum for different */ /* protocols so we hack around that by attemptint to */ /* set both tcp and udp. */ From fe0e5904c3c4d8bc689d644b40e4ba64570cb86b Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Fri, 17 May 2013 23:22:33 -0600 Subject: [PATCH 4/4] dtksh: fix a build issue with Kubuntu x86_64. Remove an apparently 'mac' definition for feature/fs and an unnecessary struct stat forward declaration. --- cde/programs/dtksh/ksh93/src/lib/libast/features/fs | 1 - cde/programs/dtksh/ksh93/src/lib/libast/include/ast_std.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/features/fs b/cde/programs/dtksh/ksh93/src/lib/libast/features/fs index 5dfd5d27a..f9c7c3b67 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/features/fs +++ b/cde/programs/dtksh/ksh93/src/lib/libast/features/fs @@ -1,4 +1,3 @@ -mac _STAT_VER,fstat,lstat,stat,_MKNOD_VER,mknod sys/types.h sys/stat.h cat{ #if defined(__uxp__) #include diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/include/ast_std.h b/cde/programs/dtksh/ksh93/src/lib/libast/include/ast_std.h index 0835df572..97004e580 100644 --- a/cde/programs/dtksh/ksh93/src/lib/libast/include/ast_std.h +++ b/cde/programs/dtksh/ksh93/src/lib/libast/include/ast_std.h @@ -341,8 +341,6 @@ typedef unsigned short wchar_t; #include #endif -struct stat; - #if defined(__cplusplus) || !defined(_std_stdlib) && !defined(__STDC__) /* */