[Pkg-tcltk-devel] Buglet in Tklib examples?

tomas at tuxteam.de tomas at tuxteam.de
Sun Dec 18 16:36:27 UTC 2011

Hash: SHA1


I'd file a bug if I knew this is considered as one. So hit me with the
clue bat as necessary...

Trying to run /usr/share/doc/tklib/examples/canvas/osm.tcl:

 | tomas at rasputin:~/tcltk/osm$ wish8.4
 | /usr/share/doc/tklib/examples/canvas/osm.tcl 
 | Error in startup script: couldn't read file "/usr/share/Tcllib/Head/modules/map/pkgIndex.tcl": no such file or directory
 |   while executing
 | "source $lmodule/map/pkgIndex.tcl"
 |   (file "/usr/share/doc/tklib/examples/canvas/osm.tcl" line 48)

Same with wish8.5. Seems the example tries to find libraries where the
script itself lives. This patch (more for explanatory purposes, I don't
think that's the "Right Way" to find libraries) takes the hurdle:

- --- /usr/share/doc/tklib/examples/canvas/osm.tcl        2009-01-22
05:00:46.000000000 +0100
+++ osm-1.tcl   2011-12-18 17:18:54.422012338 +0100
@@ -44,11 +44,11 @@
 set modules  [file join [file dirname [file dirname $selfdir]] modules]
 set lmodule  [file join [file dirname [file dirname [file dirname [file
dirname $selfdir]]]] Tcllib Head modules]

- -set dir $lmodule/map
- -source $lmodule/map/pkgIndex.tcl
+set dir /usr/share/tcltk/tklib0.5
+# source $lmodule/map/pkgIndex.tcl
+source $dir/canvas/canvas_sqmap.tcl ; # The main map support
+source $dir/canvas/canvas_zoom.tcl  ; # Zoom control
 unset dir
- -source $modules/canvas/canvas_sqmap.tcl ; # The main map support
- -source $modules/canvas/canvas_zoom.tcl  ; # Zoom control
 ## Ideas:
 ## == DONE ==

Then wish8.4 segfaults (I'm on an amd64, fwiw). Since 8.4 seems to be on
its way out, I tried 8.5:

 | tomas at rasputin:~/tcltk/osm$ wish8.5 osm.tcl 
 | Error in startup script: negative shift argument
 |     while executing
 | "expr {1 << $level}"
 |     (procedure "tiles" line 4)
 [more stack elided]

Seems the thing starts at a zoom level of -1. This fixes it:

- --- osm-1.tcl   2011-12-18 17:18:54.422012338 +0100
+++ osm-2.tcl   2011-12-18 17:19:01.118012760 +0100
@@ -287,6 +287,7 @@
     # our zoom control .z
     #puts ".z = $level"
+    if {$level<0} {set level 0}
     set rlength [map::slippy length $level]
     set region  [list 0 0 $rlength $rlength]

With both patches applied, the example works (for 8.5, that is: 8.4
still segfaults on me).

I'd be happy to provide better digestible bug reports, patches, etc. if
someone points me in the right direction.

Thanks, regards
- -- tomás
Version: GnuPG v1.4.6 (GNU/Linux)


More information about the Pkg-tcltk-devel mailing list