Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wish on Linux gets stuck with [package require Tk] but no X display

498 views
Skip to first unread message

Arjen Markus

unread,
Jan 19, 2015, 7:57:11 AM1/19/15
to
Hello,

I found an odd problem with wish on Linux:

- If wish is started without any arguments, but it has no X display to work with, it stops immediately
- If wish is started with a startup script that explicitly requires Tk, then it displays an error message, but it never stops.

The startup script is:

puts [package require Tk]; exit

Should I report this in the repository or is it a known problem? (Now that I have found out that it exists, I use [package provide] instead - the whole purpose was to find out if Tk is available and what version.)

Regards,

Arjen

Georgios Petasis

unread,
Jan 19, 2015, 8:49:34 AM1/19/15
to Arjen Markus
Dear Arjen,

It seems to work form me:

[petasis@server clarin-el]$ more test.tcl
puts [package require Tk]; exit
[petasis@server clarin-el]$ wish test.tcl
8.6.3
[petasis@server clarin-el]$

Fedora 20.

Under which linux distribution you are observing this?

George

Arjen Markus

unread,
Jan 19, 2015, 8:56:36 AM1/19/15
to
Op maandag 19 januari 2015 14:49:34 UTC+1 schreef Georgios Petasis:
Hi George,

it works fine if wish can connect to the X display. If it cannot, because the DISPLAY environment variable is wrongly or there is no display at all, then you should get:

Application initialization failed: no display name and no $DISPLAY environment variable

I have found this problem on CentOS release 5.6.

Regards,

Arjen

Georgios Petasis

unread,
Jan 19, 2015, 9:37:46 AM1/19/15
to Arjen Markus
I have tried this in my CentOS 6.6 (I don't have 5.6):

[petasis@localhost ~]$ unset DISPLAY
[petasis@localhost ~]$ more test.tcl
puts [package require Tk]; exit
[petasis@localhost ~]$ time wish test.tcl
application-specific initialization failed: no display name and no
$DISPLAY environment variable
Error in startup script: no display name and no $DISPLAY environment
variable
while executing
"load /opt/ActiveTcl-8.6/lib/tk8.6/../libtk8.6.so Tk"
("package ifneeded Tk 8.6.0" script)
invoked from within
"package require Tk"
invoked from within
"puts [package require Tk]"
(file "test.tcl" line 1)

real 0m0.049s
user 0m0.024s
sys 0m0.022s
[petasis@localhost ~]$ time wish
application-specific initialization failed: no display name and no
$DISPLAY environment variable
%
real 0m0.010s
user 0m0.005s
sys 0m0.004s
[petasis@localhost ~]$

I used time, because the first time I run "wish test.tcl" was a
noticeable delay between the first message, and the error in start-up
script. About 1 second. In your case, it never terminates?

George

Robert Heller

unread,
Jan 19, 2015, 9:48:06 AM1/19/15
to
Yes, even CentOS 5.11 has this problem:

bash-3.2$ unset DISPLAY
bash-3.2$ wish
Application initialization failed: no display name and no $DISPLAY environment variable
% bash-3.2$ tclsh
% puts [package require Tk]; exit
no display name and no $DISPLAY environment variable
% exit
bash-3.2$ cat >/tmp/test.tcl
puts [package require Tk]; exit
bash-3.2$ tclsh /tmp/test.tcl
no display name and no $DISPLAY environment variable
while executing
"load /usr/lib/tk8.4/../libtk8.4.so Tk"
("package ifneeded" script)
invoked from within
"package require Tk"
invoked from within
"puts [package require Tk]"
(file "/tmp/test.tcl" line 1)
bash-3.2$ wish /tmp/test.tcl
Application initialization failed: no display name and no $DISPLAY environment variable


(hangs at this point).

Note: The default tcl/tk on CentOS 5 is 8.4:

bash-3.2$ rpm -qa tcl tk
tk-8.4.13-5.el5_1.1
tcl-8.4.13-6.el5


It only hangs if there is a package require for Tk when *wish* is invoked.
Invoking *wish* implies [package require Tk]. Doing a package require in
plain tclsh, raises a error, complete with traceback.



>
> Arjen
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Uwe Klein

unread,
Jan 19, 2015, 9:50:05 AM1/19/15
to
Does it block "for ever and ever and ever" or just the usual tcp timeout?

What does the environment show for DISPLAY ?

uwe

Rich

unread,
Jan 19, 2015, 12:22:08 PM1/19/15
to
Arjen Markus <arjen.m...@gmail.com> wrote:
> Hello,

> I found an odd problem with wish on Linux:

> - If wish is started without any arguments, but it has no X display
> - to work with, it stops immediately
> - If wish is started with a startup script that explicitly requires
> - Tk, then it displays an error message, but it never stops.

> The startup script is:

> puts [package require Tk]; exit

Works as expected under Slackware 14.1 (64bit) and Tcl 8.6.1 when there
is no DISPLAY variable:

/tmp$ unset DISPLAY
/tmp$ unset HOSTDISPLAY
/tmp$ env | grep DISPLAY
/tmp$ cat bt.tcl
puts [package require Tk]; exit
/tmp$ wish bt.tcl
application-specific initialization failed: no display name and no
$DISPLAY environment variable
Error in startup script: no display name and no $DISPLAY environment
variable
while executing
"load /usr/lib64/libtk8.6.so Tk"
("package ifneeded Tk 8.6.1" script)
invoked from within
"package require Tk"
invoked from within
"puts [package require Tk]"
(file "bt.tcl" line 1)
/tmp$

It automatically dropped out to the prompt.

Arjen Markus

unread,
Jan 20, 2015, 2:27:07 AM1/20/15
to
Okay, so the results are quite varied.

I just checked: the system I was using has Tcl 8.4 installed - there is a newer version available, but that does not include wish, unfortunately.

tclsh fails immediately, but wish simply hangs, for at least several minutes (which signals the end of my patience ;)).

The environment variable DISPLAY has no value when I try this.

Since this occurs with a particularly old version of Tcl/Tk and the results are so varied, it is probably not worth the trouble. At least I have my workaround.

Regards,

Arjen
0 new messages