hi,
modules 2.4 crashes with a segmentation fault when called with no argument:
deparade@debussy:archive/Modules-2.4BETA2> module
Segmentation fault
This happens, because because Initialize_Tcl() from init.cmd only
gives an error, if argc < 2.
In the above case, argc is 2:
argv[0]=.../modulecmd
argv[1]=tcsh
But cmdModule() from cmdModule.c assumes that there is a third
argument: the modulecmd. Since there is none, it crashes.
It would be nice, if argc == 2 behaves like `module help'.
The following patch is an ugly work-around, but keeps module from
crashing. It also fixes a small typo (" shellname" instead of "shellname"):
----------------------cut-----------------------
*** init Wed Aug 21 17:32:32 1996
--- init.c Wed Aug 21 17:32:36 1996
***************
*** 248,256 ****
**/
if(argc < 2)
! if( OK != ErrorLogger( ERR_USAGE, LOC, argv[0], "shellname", NULL))
return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
strcpy( shell_name, argv[1]);
/**
--- 248,262 ----
**/
if(argc < 2)
! if( OK != ErrorLogger( ERR_USAGE, LOC, argv[0], " shellname", NULL))
return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
+ /* get argc==2 error; dpi; Wed Aug 21 17:15:24 MET DST 1996 */
+ if(argc ==2)
+ if( OK != ErrorLogger( ERR_USAGE, LOC, argv[0], " shellname help", NULL))
+ return( TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/
+
+ /* end of patch */
strcpy( shell_name, argv[1]);
/**
----------------------cut-----------------------
dpi
|