Hello again,
This is another purely bugfixing patch. It turned out that there was
a major problem with the Beta version's "update" subcommand. Namely,
environment variables read from the _MODULESBEGINENV_ file had
spurious newlines at the ends or beginnings. This is fixed by this
patch.
Besides being included below, this patch can be found in two places:
http://www.cs.wustl.edu/~flan/patch2-flan
ftp://wuarchive.wustl.edu/pub/UNIX_UPLOADS/Modules3.0Beta1.patch2-flan
(It may take a day or two for the file to appear on wuarchive because
that is under their control, not mine.)
Note: you should apply patch1-flan *before* trying to install this
patch. You can find patch1-flan at the following two places:
http://www.cs.wustl.edu/~flan/patch1-flan
ftp://wuarchive.wustl.edu/pub/UNIX_UPLOADS/Modules3.0Beta1.patch1-flan
Please let me know if you have any problems installing this patch or
compiling once the patch is installed.
I hope this helps.
Ian Flanigan
fl...@cs...
--- cut here ---
Index: ChangeLog
===================================================================
RCS file: /home/pkgmaster/CVSRepository/Modules/ChangeLog,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -c -r1.1.1.1.2.1 -r1.1.1.1.2.2
*** ChangeLog 1997/01/06 03:48:03 1.1.1.1.2.1
--- ChangeLog 1997/01/26 00:23:15 1.1.1.1.2.2
***************
*** 1,3 ****
--- 1,10 ----
+ Sat Jan 25 16:08:37 1997 Ian Flanigan <fl...@cs...>
+
+ * ModuleCmd_Update.c (ModuleCmd_Update): Fixed a heinous
+ environment bug that caused extraneous newlines in environment
+ variables. As a consequence, the function now uses fgets(), which
+ is better than the pointer-munging that was there.
+
Sun Jan 5 19:04:18 1997 Ian Flanigan <fl...@cs...>
* Makefile.in: added config.cache, config.h, and config.log to
***************
*** 35,42 ****
* Makefile.in, doc/Makefile.in, init/Makefile.in, configure.in:
Added support for the --program-transform name option to
configure. Unfortunately, it only gets used on the actual
! *program*, not the init files. Also change the default init file
! and modulefile installation directories to be under $(prefix)/lib
**************************** Release 3.0 ******************************
--- 42,48 ----
* Makefile.in, doc/Makefile.in, init/Makefile.in, configure.in:
Added support for the --program-transform name option to
configure. Unfortunately, it only gets used on the actual
! *program*, not the init files.
**************************** Release 3.0 ******************************
Index: ModuleCmd_Update.c
===================================================================
RCS file: /home/pkgmaster/CVSRepository/Modules/ModuleCmd_Update.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -c -r1.1.1.1 -r1.1.1.1.2.1
*** ModuleCmd_Update.c 1996/12/24 03:25:51 1.1.1.1
--- ModuleCmd_Update.c 1997/01/26 00:20:56 1.1.1.1.2.1
***************
*** 93,99 ****
/** Description: Execution of the module-command 'update' **/
/** **/
/** First Edition: 91/10/23 **/
! /** Last Mod.: 95/07/13 **/
/** **/
/** Parameters: Tcl_Interp *interp Attached Tcl Interp. **/
/** int argc Number of arguments **/
--- 93,99 ----
/** Description: Execution of the module-command 'update' **/
/** **/
/** First Edition: 91/10/23 **/
! /** Last Mod.: 96/01/23 **/
/** **/
/** Parameters: Tcl_Interp *interp Attached Tcl Interp. **/
/** int argc Number of arguments **/
***************
*** 162,229 ****
/**
** Trigger to entries of the type
** <variable> = <value>
**/
! ptr = buf;
! while( !feof( file)) {
!
! if((ptr-buf) >= buffer_size-10) { /** 10 bytes safety **/
! if( NULL == (buf = (char*) malloc(
! buffer_size += UPD_BUFSIZE))) {
! if( OK != ErrorLogger( ERR_ALLOC, LOC, NULL))
! return( TCL_ERROR); /** EXIT (FAILURE) **/
! }
! }
!
! /**
! ** Read a character and put it into the read buffer. Check
! ** for the lines (CR) or a terminator character ...
! **/
!
! if( '\n' == (*ptr++ = c = fgetc( file))) {
! *ptr++ = c = '\0';
! break;
! }
!
! if( !c)
! break;
!
! } /** while **/
!
! /**
! ** If there hasn't been a terminator so far, put it at the
! ** end of the line. Therefor we've left a safety space at the
! ** buffers end ;-)
! **/
!
! if( c)
! *ptr++ = '\0';
!
! /**
! ** Now let's evaluate the read line
! **/
!
! if( var_ptr = strchr( buf, '=')) {
!
! *var_ptr = '\0';
! val_ptr = var_ptr+1;
! var_ptr = buf;
!
! /**
! ** Reset the environment to the values derivered from the
! ** _MODULESBEGINENV_.
! ** Do not change the LOADEDMODULES variable ;-)
! ** Do not change the TCL_LIBRARY and TK_LIBRARY also.
! **/
!
! if( strncmp( var_ptr, "LOADEDMODULES", 12) &&
! strncmp( var_ptr, "TCL_LIBRARY", 10 ) &&
! strncmp( var_ptr, "TK_LIBRARY", 9 ))
! if( !strncmp( var_ptr, "MODULEPATH", 10))
! moduleSetenv( interp, var_ptr, val_ptr, 1);
! else
! Tcl_SetVar2( interp, "env", var_ptr, val_ptr,
! TCL_GLOBAL_ONLY);
} /** if( var_ptr) **/
} /** while **/
--- 162,205 ----
/**
** Trigger to entries of the type
** <variable> = <value>
+ **
+ ** (This code silently assumes that environment variables
+ ** do not contain newlines. This is not a good assumption,
+ ** but it's a pain to fix properly at the moment.)
**/
! fgets( buf, UPD_BUFSIZE, file); /* Get a line */
! ptr = strchr( buf, '\n');
! if (ptr) {
! *ptr = '\0';
! }
! ptr = strchr( buf, '=');
! if (ptr) {
! *ptr = '\0';
! val_ptr = ptr + 1;
! }
! else {
! val_ptr = "";
! }
! var_ptr = buf;
!
! /**
! ** Reset the environment to the values derivered from the
! ** _MODULESBEGINENV_.
! ** Do not change the LOADEDMODULES variable ;-)
! ** Do not change the TCL_LIBRARY and TK_LIBRARY also.
! **/
!
! if( strncmp( var_ptr, "LOADEDMODULES", 12) != 0 &&
! strncmp( var_ptr, "TCL_LIBRARY", 10 ) != 0 &&
! strncmp( var_ptr, "TK_LIBRARY", 9 ) != 0) {
! if( strncmp( var_ptr, "MODULEPATH", 10) == 0) {
! moduleSetenv( interp, var_ptr, val_ptr, 1);
! }
! else {
! Tcl_SetVar2( interp, "env", var_ptr, val_ptr,
! TCL_GLOBAL_ONLY);
! }
} /** if( var_ptr) **/
} /** while **/
|