From bd734d2cf44d9550acd5c2ca3e6c5b17f9b03f72 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Thu, 23 Jul 2009 22:49:15 +0000 Subject: * generic/tclIO.c (Tcl_GetChannelHandle): Do not crash for * generic/tclPipe.c (FileForRedirect): getHandleProc == NULL, this is allowed. Provide a nice error message in the bypass area. Updated caller to check the bypass for a mesage. This fixes the bug [Bug 2826248] reported by Andy Sonnenburg --- ChangeLog | 9 +++++++++ generic/tclIO.c | 10 +++++++++- generic/tclPipe.c | 14 ++++++++++---- generic/tclVar.c | 15 ++++++++++++--- tools/genStubs.tcl | 5 ++++- unix/Makefile.in | 6 +++--- unix/configure | 6 ++++++ unix/tcl.m4 | 8 +++++++- win/Makefile.in | 6 +++--- 9 files changed, 63 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4b4001..e81578a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-07-23 Andreas Kupries + + * generic/tclIO.c (Tcl_GetChannelHandle): Do not crash for + * generic/tclPipe.c (FileForRedirect): getHandleProc == NULL, this + is allowed. Provide a nice error message in the bypass + area. Updated caller to check the bypass for a mesage. This fixes + the bug [Bug 2826248] reported by Andy Sonnenburg + + 2009-07-23 Joe Mistachkin * generic/tclNotify.c: Fix for [Bug 2820349]. diff --git a/generic/tclIO.c b/generic/tclIO.c index 7814e32..4f676e6 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.159 2009/02/10 22:49:45 nijtmans Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.160 2009/07/23 22:49:15 andreas_kupries Exp $ */ #include "tclInt.h" @@ -2085,6 +2085,14 @@ Tcl_GetChannelHandle( int result; chanPtr = ((Channel *) chan)->state->bottomChanPtr; + if (!chanPtr->typePtr->getHandleProc) { + Tcl_Obj* err; + TclNewLiteralStringObj(err, "channel \""); + Tcl_AppendToObj(err, Tcl_GetChannelName(chan), -1); + Tcl_AppendToObj(err, "\" does not support OS handles", -1); + Tcl_SetChannelError (chan,err); + return TCL_ERROR; + } result = chanPtr->typePtr->getHandleProc(chanPtr->instanceData, direction, &handle); if (handlePtr) { diff --git a/generic/tclPipe.c b/generic/tclPipe.c index b20ffe1..e8e4f74 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPipe.c,v 1.21 2009/01/09 11:21:46 dkf Exp $ + * RCS: @(#) $Id: tclPipe.c,v 1.22 2009/07/23 22:49:15 andreas_kupries Exp $ */ #include "tclInt.h" @@ -102,9 +102,15 @@ FileForRedirect( } file = TclpMakeFile(chan, writing ? TCL_WRITABLE : TCL_READABLE); if (file == NULL) { - Tcl_AppendResult(interp, "channel \"", Tcl_GetChannelName(chan), - "\" wasn't opened for ", - ((writing) ? "writing" : "reading"), NULL); + Tcl_Obj* msg; + Tcl_GetChannelError(chan, &msg); + if (msg) { + Tcl_SetObjResult (interp, msg); + } else { + Tcl_AppendResult(interp, "channel \"", Tcl_GetChannelName(chan), + "\" wasn't opened for ", + ((writing) ? "writing" : "reading"), NULL); + } return NULL; } *releasePtr = 1; diff --git a/generic/tclVar.c b/generic/tclVar.c index eb7cf53..c733dce 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.179 2009/07/16 21:24:40 dgp Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.180 2009/07/23 22:49:15 andreas_kupries Exp $ */ #include "tclInt.h" @@ -67,10 +67,19 @@ VarHashCreateVar( #define VarHashFindVar(tablePtr, key) \ VarHashCreateVar((tablePtr), (key), NULL) - +#ifdef _AIX +/* Work around AIX cc problem causing crash in TclDeleteVars. Possible + * optimizer bug. Do _NOT_ inline this function, this re-activates the + * problem. + */ +static void +VarHashInvalidateEntry(Var* varPtr) { + varPtr->flags |= VAR_DEAD_HASH; +} +#else #define VarHashInvalidateEntry(varPtr) \ ((varPtr)->flags |= VAR_DEAD_HASH) - +#endif #define VarHashDeleteEntry(varPtr) \ Tcl_DeleteHashEntry(&(((VarInHash *) varPtr)->entry)) diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 17fb4ac..96a1a83 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: genStubs.tcl,v 1.29 2008/10/22 20:24:00 nijtmans Exp $ +# RCS: @(#) $Id: genStubs.tcl,v 1.30 2009/07/23 22:49:15 andreas_kupries Exp $ package require Tcl 8.4 @@ -208,6 +208,9 @@ proc genStubs::rewriteFile {file text} { set in [open ${file} r] set out [open ${file}.new w] + # Hardwire the genstubs output to Unix eol. + fconfigure $out -translation lf + while {![eof $in]} { set line [gets $in] if {[string match "*!BEGIN!*" $line]} { diff --git a/unix/Makefile.in b/unix/Makefile.in index d210013..2e1dcc6 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.272 2009/07/18 08:16:06 das Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.273 2009/07/23 22:49:15 andreas_kupries Exp $ VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ @@ -912,8 +912,8 @@ install-private-headers: libraries $(INSTALL_DATA) tclConfig.h "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \ fi; -Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in - $(SHELL) config.status +#Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in +# $(SHELL) config.status #tclConfig.h: $(UNIX_DIR)/tclConfig.h.in # $(SHELL) config.status diff --git a/unix/configure b/unix/configure index 6b4b375..f490ca6 100755 --- a/unix/configure +++ b/unix/configure @@ -7174,6 +7174,12 @@ fi fi + + # 64bit not requested or not, may still be a 64bit platform. + if test "`uname -m`" = ia64 ; then + SHLIB_LD_LIBS="-L/lib/hpux64 ${SHLIB_LD_LIBS}" +fi + ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 479ea08..28050dd 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1312,7 +1312,13 @@ dnl AC_CHECK_TOOL(AR, ar) CFLAGS="$CFLAGS +DD64" LDFLAGS_ARCH="+DD64" ]) - ]) ;; + ]) + + # 64bit not requested or not, may still be a 64bit platform. + AS_IF([test "`uname -m`" = ia64], [ + SHLIB_LD_LIBS="-L/lib/hpux64 ${SHLIB_LD_LIBS}" + ]) + ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) diff --git a/win/Makefile.in b/win/Makefile.in index 21c9990..6983879 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.156 2009/05/29 16:28:40 andreas_kupries Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.157 2009/07/23 22:49:16 andreas_kupries Exp $ VERSION = @TCL_VERSION@ @@ -779,8 +779,8 @@ gdb: binaries depend: -Makefile: $(SRC_DIR)/Makefile.in - ./config.status +#Makefile: $(SRC_DIR)/Makefile.in +# ./config.status cleanhelp: $(RM) *.hlp *.cnt *.GID *.rtf man2tcl.exe -- cgit v0.12