tcl broken?

Elan Ruusamäe glen at pld-linux.org
Mon May 11 21:26:20 CEST 2009


On Thursday 19 February 2009 10:02:18 Adam Gołębiowski wrote:
> Hi,
>
> [adamg at carme-pld-i686 SPECS]$ echo 'puts stdout "a"'  | tclsh
> a
> Tcl_SetObjLength called with shared object
> Aborted
> [adamg at carme-pld-i686 SPECS]$
>
> this causes sqlite3 build failure (and probably other software).

http://forums13.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=1310861

appears the history.tcl or history related entry in tclIndex is the cause.

thus, one of these provide the fix:
1. remove /usr/lib/tcl8.5/history.tcl
2. removing (commenting out) from /usr/lib/tcl8.5/tclIndex this line:
set auto_index(history) [list source [file join $dir history.tcl]]

manual for Tcl_IsShared says: 
       Command  procedures that directly modify objects such as those for lap-
       pend and linsert must be careful to copy a shared object before  chang-
       ing  it.  They must first check whether the object is shared by calling
       Tcl_IsShared.  If the object is shared they must  copy  the  object  by
       using  Tcl_DuplicateObj;  this  returns a new duplicate of the original
       object that has refCount 0.  If the object is not shared,  the  command
       procedure  “owns”  the  object  and can safely modify it directly.  For
       example, the following code  appears  in  the  command  procedure  that
       implements  linsert.  This procedure modifies the list object passed to
       it in objv[1] by inserting objc-3 new elements before index.

              listPtr = objv[1];
              if (Tcl_IsShared(listPtr)) {
                  listPtr = Tcl_DuplicateObj(listPtr);
              }
              result = Tcl_ListObjReplace(interp, listPtr, index, 0,
                      (objc-3), &(objv[3]));

... from which i conclude history.tcl does something too early...

-- 
glen


More information about the pld-devel-en mailing list