Debug tclsh
De HurdFr_Wiki.
tclsh debugging
Goal
tclsh is used in autotools' ./configure to get the found TCL version. The problematic line is this one:
TCL_VERSION_FOUND=`echo 'puts [info tclversion]' | $TCLSH`
$TCLSH contains the full path to tclsh, which is: /usr/bin/tclsh; we'll use the binary name from now.
When trying this:
echo 'puts [info tclversion]' | tclsh
we get '8.4' as expected (tcl8.4 is the package we're considering).
But when trying this:
A=`echo 'puts [info tclversion]' | tclsh`; echo $A
that hangs on hurd-i386. :-s
The first thing we can think about is a wrong use of stdin by tclsh. After having read the manual, we try that:
T=`mktemp` echo 'puts [info tclversion]' > $T tclsh $T
which gives '8.4' too, but we've got:
A=`tclsh $T`
still hangs on hurd-i386...
stdout?
After some tests, I found out that stdout could be involved. Quick summary of what's working or not. $T is a file containing the following instruction: puts [info tclversion]
| Command | hurd-i386 | powerpc |
|---|---|---|
| tclsh $T | 8.4 | 8.4 |
| V=`tclsh $T`; echo $V | (hangs) | 8.4 |
| V=`tclsh $T > /tmp/test; cat /tmp/test`; echo $V | 8.4 | 8.4 |
| V=`tclsh $T [pipe] cat`; echo $V | (hangs) | 8.4 |
| V=`tclsh $T [pipe] cat > /tmp/something`; echo $V | (hangs) | (outputs nothing) |

