[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ns and otcl crash on specific variable names



First of all, the crash is due to an missing "return" in an OTcl function.
The enclosed patch should do it.

However, one still will not be able to create any variable with name 'p1'
and 'p2', due to some unknown interaction with the Tcl name spaces. We are
still investigating this problem, but for now, please do not use these two
names as otcl objects.

Thanks for the report.

- Haobo

--- otcl.c~     1998/09/07 18:53:43     
+++ otcl.c      1999/05/13 23:30:13     
@@ -1,6 +1,6 @@
 /* -*- Mode: c++ -*-
  *
- *  $Id: otcl.c,v 1.14 1998/09/07 18:53:43 haoboy Exp $
+ *  $Id: otcl.c,v 1.15 1999/05/13 23:30:13 haoboy Exp $
  *  
  *  Copyright 1993 Massachusetts Institute of Technology
  * 
@@ -1522,7 +1522,8 @@
   if (result != TCL_OK) return result;
 
   obj = OTclGetObject(in, argv[4]);
-  if (obj == 0) OTclErrMsg(in, "couldn't find result of alloc",
TCL_STATIC);
+  if (obj == 0) 
+         return OTclErrMsg(in, "couldn't find result of alloc",
TCL_STATIC);
   (void)RemoveInstance(obj, obj->cl);
   AddInstance(obj, cl);


On 13 May 1999, Hongxia Quan wrote:

> Hi, All:
> 
> I download the latest version of ns and build it on redhat linux. 
> Then I went to otcl directory and started otclsh
> 
> bonita:otcl-1.0a4 > otclsh
> % Class Bagel
> Bagel
> % Bagel p
> p
> % Bagel p1
> Segmentation fault
> 
> bonita:otcl-1.0a4 >    
>                
> This looks like otcl does not like variable names p2. Then I started ns.
> 
> bonita:otcl-1.0a4 > cd ../ns-2.1b5/
> bonita:ns-2.1b5 > ns
> % Simulator p2
> Segmentation fault
> 
> bonita:ns-2.1b5 > ns
> % Simulator p
> p
> % exit
> 
> bonita:ns-2.1b5 >
> 
> 
> Does anyone know why variable name p2 caused ns and otcl to crash and how to fix it? Any ideas will be appreciated. Thanks.
> 
> Hongxia
>