#1320 TCL/Tk scripts can crash with "segmentation fault"

open
nobody
None
5
2014-05-24
2014-05-24
Zbigniew
No

Consider following short script:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/env tclsh

package require Tk

set ::icon(table-16) [image create photo]
$::icon(table-16) put {
R0lGODlhEAAQAIUAAISu5Iyy5Iyy7Hyu5Hyq7HSm5Gyi7GSe5GSe7GSi7ESa7AQ2XPwCBLTW
/JTG/Hy6/FSm/DSW/AyG/AR+/AR2/AQyVJS65Mzi/Mze/Lza/KTK/JzK/IzG9IzC/Fy2/Jy+
7Pz+/Pz6/PT6/Oz2/Oz6/KS+7PT+/OT2/Nzy/ITG/OTy/Nz2/Jy+5NTu/NTy/ITC9Mzu/HzC
9AQyXGSq5JTK/ITG9AQ6ZAQeNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAwALAAA
AAAQABAAAAazQEBAMCAUDAfEIXEwKBYMQcPxgEQkE4pWO6kwLBdMpqHZOBwcTmfj8X5AIZBI
LheNSCGOtwTqm0IiIiQnIygkKW5wgoMnKicoKCt6DHx/JIIjjSiOiAwscownjygtLi4veyAk
IyKEm6YtKJMsJqKikKUwLS0xeySrmiguMCowLr2ewJCmMM3ND3smg62FwsMrKTIMMzQpHN4c
NQ8cMTEpbQwLFesVMu3v7jY3DPT19vf0fkEAIf5oQ3JlYXRlZCBieSBCTVBUb0dJRiBQcm8g
dmVyc2lvbiAyLjUNCqkgRGV2ZWxDb3IgMTk5NywxOTk4LiBBbGwgcmlnaHRzIHJlc2VydmVk
Lg0KaHR0cDovL3d3dy5kZXZlbGNvci5jb20AOw==}

pack [ttk::frame .top] -padx 3 -pady 3
set path .top
grid [ttk::button $path.tables -command manageTables -text "Table name" \
 -compound left -image $::icon(table-16)] -row 0 -column 0 -sticky e -padx 2

This script works with no problems whatsoever, when run locally. But it crashes nastily (segmentation fault), when I'm trying to run it in TightVNC 1.3.10 session on remote machine (by using vncserver). The crash somehow is caused by the last line, the one with "grid". Tried it with TCL/Tk 8.5.11 first, then upgraded to 8.6.1, but it didn't help. Linux Slackware 14.0 (and 14.1).

I would to stress here, that there are no hardware/software differences. When the script was run "locally" - by operator of that remote machine - it works fine, but when I'm trying to run in remotely, connecting still to the very same machine in VNC session, the script crashes.

The posters on comp.lang.tcl discovered, that 1) by removing the icon from the button we can prevent it from segfaulting, therefore tightvncserver's problem is rather strictly Tk-related, and 2) that earlier version of tightvncserver - 1.3.9-6.4 in Debian wheezy - doesn't crash.

Therefore some kind of regression happened. Or maybe tightvncserver in Debian has been patched by Debian people (didn't check it yet).

Discussion