karl@sugar.hackercorp.com (Karl Lehenbauer) (12/22/90)
Archive-name: tcl4.0/patch1 Patch #: 1 Priority: MEDIUM patch 1 to Tcl 4.0 ================== This patch fixes three relatively minor problems with Tcl, described in detail below. Fix: From rn, say "| patch -p -N -d DIR", where DIR is your Tcl 4.0 source directory. Outside of rn, say "cd DIR; patch -p -N <thisarticle". If you don't have the patch program, apply the following by hand, or get patch (version 2.0, latest patchlevel). After patching: Configure make make bldhelp make install If patch indicates that patchlevel is the wrong version, the patch may already have been applied. See the patchlevel.h file to find out what has or has not been applied. In any event, don't continue with the patch. strerror function ----------------- Some BSD variants (Sun-OS, apparently BSD-tahoe) do not have the strerror function. Tcl has one for these cases, but Configure doesn't realize that it is needed. Consequently, if you are configuring for BSD the Configure script will ask if you have strerror in your C library. If you don't know, answer "y" and if you get a link error saying it's not found, run Configure again and say "n" to that question. getenv ------ getenv -- a memory overwrite would occur if an environment variable body returned by getenv was greater in length that TCL_RESULT_SIZE, i.e. 199 bytes. help and other procedures not being found after an install ---------------------------------------------------------- The problem here is a very simple one. "make install" copies the Tcl source files and libraries from the directory they were unpacked/built from to the place they are to reside. Unfortunately, the .tndx files (there could be many of them, but right now there's only one) get copied and really they shouldn't, they should be rebuilt by the install procedure and, after this patch, they are. MEMORY DEBUGGING WARNING ------------------------ Modules compiled with memory debugging enabled are incompatible with modules that were not compiled with it. If you reconfigure to have memory debugging or to not have it, you should do a make clean and rebuild to insure that all C source is recompiled. If you suddenly start getting overwrites on a system that used to work, you might check for some .o files that didn't get deleted or something after the "make clean". DOCUMENTATION PATCH IS FORTHCOMING ---------------------------------- If you've printed the man pages, no doubt you've found some annoying little problems with them, plus some entries need to be updated. We are preparing a documentation patch, hopefully it will be ready within the next week. And now, the patch... Index: tclsh/src/patchlevel.h Prereq: 0 *************** *** 1,2 ! #define PATCHLEVEL 0 --- 1,2 ----- ! #define PATCHLEVEL 1 Index: extend/src/unixcmds.c *************** *** 357,363 return TCL_OK; } ! if (envstr != NULL) strcpy(interp->result, envstr); return TCL_OK; } --- 357,368 ----- return TCL_OK; } ! if (envstr != NULL) { /* Section modified by Glenn M. Lewis - 12/20/90 */ ! int size = strlen(envstr); ! if (size >= TCL_RESULT_SIZE) { ! interp->result = ckalloc(size + 1); ! interp->dynamic = TCL_DYNAMIC; ! } strcpy(interp->result, envstr); } return TCL_OK; *************** *** 359,364 if (envstr != NULL) strcpy(interp->result, envstr); return TCL_OK; } --- 364,370 ----- interp->dynamic = TCL_DYNAMIC; } strcpy(interp->result, envstr); + } return TCL_OK; } Index: Configure *************** *** 112,117 fi done if [ "$TCL_BINDIR" = "" ] then TCL_BINDIR=$CWD --- 112,132 ----- fi done + if [ "$UNIX_TYPE" = "bsd" ] + then + if [ "$HAS_STRERROR" = "" ] + then + HAS_STRERROR="y" + fi + echo "Does your C library have the strerror function?" + echo "[$HAS_STRERROR]: \c" + read A + if [ "$A" != "" ] + then + HAS_STRERROR=$A + fi + fi + if [ "$TCL_BINDIR" = "" ] then TCL_BINDIR=$CWD *************** *** 297,302 echo "TCL_MEM_DEBUG=\""$TCL_MEM_DEBUG\" >>$CONFIG echo "TCL_MEM_VALIDATE=\""$TCL_MEM_VALIDATE\" >>$CONFIG echo "TCL_DEFAULTFILE=\""$TCL_DEFAULTFILE\" >>$CONFIG echo creating $CONFIG_H echo "/* generated by Configure script -- don't edit by hand */" >$CONFIG_H --- 312,318 ----- echo "TCL_MEM_DEBUG=\""$TCL_MEM_DEBUG\" >>$CONFIG echo "TCL_MEM_VALIDATE=\""$TCL_MEM_VALIDATE\" >>$CONFIG echo "TCL_DEFAULTFILE=\""$TCL_DEFAULTFILE\" >>$CONFIG + echo "HAS_STRERROR=\""$HAS_STRERROR\" >>$CONFIG echo creating $CONFIG_H echo "/* generated by Configure script -- don't edit by hand */" >$CONFIG_H *************** *** 341,347 bsd) MF_SYSDEF="SYSDEF= -DBSD"; MF_RANLIB="RANLIB=ranlib"; MF_OS_OBJS="strtol.o strtoul.o strstr.o putenv.o panic.o ascftime.o";; - hpux) MF_SYSDEF="SYSDEF= -DSYSV -DHPUX"; MF_LIBS="LIBS=-lBSD -lPW"; MF_OS_OBJS="panic.o";; --- 357,362 ----- bsd) MF_SYSDEF="SYSDEF= -DBSD"; MF_RANLIB="RANLIB=ranlib"; MF_OS_OBJS="strtol.o strtoul.o strstr.o putenv.o panic.o ascftime.o";; hpux) MF_SYSDEF="SYSDEF= -DSYSV -DHPUX"; MF_LIBS="LIBS=-lBSD -lPW"; MF_OS_OBJS="panic.o";; *************** *** 360,365 MF_OS_OBJS="strstr.o strtoul.o panic.o ascftime.o";; esac MF_COMPOPTS="COMPOPTS= $VOID" if [ "$TCL_HISTORY" = "n" ] --- 375,386 ----- MF_OS_OBJS="strstr.o strtoul.o panic.o ascftime.o";; esac + if [ "$UNIX_TYPE" = "bsd" -a "$HAS_STRERROR" = "n" ] + then + MF_OS_OBJS="$MF_OS_OBJS strerror.o" + fi + + MF_COMPOPTS="COMPOPTS= $VOID" if [ "$TCL_HISTORY" = "n" ] *************** *** 450,455 echo " -rm -rf $TCL_SOURCEDIR/help" >> Makefile echo " -mkdir $TCL_SOURCEDIR/help" >> Makefile echo " -./tcl -f tclsh/tclsrc/copydir.tcl tclsh/tclsrc $TCL_SOURCEDIR" >> Makefile echo " -find $TCL_SOURCEDIR -type f -exec chmod go-w,a+r {} \;" >>Makefile echo " -find $TCL_SOURCEDIR -type d -exec chmod go-w,a+rx {} \;" >>Makefile fi --- 471,478 ----- echo " -rm -rf $TCL_SOURCEDIR/help" >> Makefile echo " -mkdir $TCL_SOURCEDIR/help" >> Makefile echo " -./tcl -f tclsh/tclsrc/copydir.tcl tclsh/tclsrc $TCL_SOURCEDIR" >> Makefile + echo " -rm -f $TCL_SOURCEDIR/*.ndx" >> Makefile + echo " -./tcl \"source tclsh/tclsrc/packages.tcl; set TCL_PATHLIST $TCL_SOURCEDIR; build_package_indexes\"" >> Makefile echo " -find $TCL_SOURCEDIR -type f -exec chmod go-w,a+r {} \;" >>Makefile echo " -find $TCL_SOURCEDIR -type d -exec chmod go-w,a+rx {} \;" >>Makefile fi -- -- uunet!sugar!karl -- Usenet access: (713) 438-5018 -- -- uunet!sugar!karl -- Usenet access: (713) 438-5018