Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 226785 - RawHide rebuild request: tcl went 8.4->8.5
Summary: RawHide rebuild request: tcl went 8.4->8.5
Alias: None
Product: Fedora
Classification: Fedora
Component: expect
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Miloslav Trmač
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2007-02-01 16:21 UTC by Jan Kratochvil
Modified: 2007-11-30 22:11 UTC (History)
3 users (show)

Fixed In Version: 5.43.0-6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-02-04 20:22:54 UTC

Attachments (Terms of Use)

Description Jan Kratochvil 2007-02-01 16:21:44 UTC
rawhide report: 20070201 changes

Broken deps for i386
        expect - 5.43.0-5.1.i386 requires
        expectk - 5.43.0-5.1.i386 requires
        expectk - 5.43.0-5.1.i386 requires

* Thu Jan 25 2007 Marcela Maslanova <> - 8.5a5-5
- rebuilt

* Mon Dec 18 2006 Marcela Maslanova <> - 8.5a5-4
- change in spec for compatibility with tk, version 8.5a5
- Resolves: rhbz#160441
Error: Missing Dependency: is needed by package expect

Comment 1 Jan Kratochvil 2007-02-01 16:23:48 UTC
(sure I do not care now of expectk, a typo)

Comment 2 Jakub Jelinek 2007-02-04 18:24:20 UTC
expect doesn't rebuild in rawhide.
The problem is:
1) make apparently doesn't have fully fixed the RLIMIT_STACK bug, so the:
TCL_LIBRARY=/usr/include/tcl-private/library ; \
        export TCL_LIBRARY ; \
LD_LIBRARY_PATH=.:/usr/lib:/var/tmp/expect-5.43.0-6-root/usr/lib:$LD_LIBRARY_PATH ./expect ./fixline1 /usr/bin < ./example/timed-run > timed-run
Tcl_Init failed: too many nested evaluations (infinite loop?)

command is executed with ulimit -s unlimited
2) on x86_64 kernel, 32-bit mock root, pthread_getattr_np returns in the initial
thread how much the stack can actually grow at that point, if I try say:
extern int TclpThreadGetStackSize(void); int main (void) { __builtin_printf
("%x\n", TclpThreadGetStackSize ()); }
linked against -ltcl8.5 it prints aa650000
3) TclpThreadGetStackSize has misdesigned return value, returning stack sizes
in an int is a joke.  It must be size_t instead.
4) TclpCheckStackSpace has:
    if (tsdPtr->initialised == 0) {
         * We appear to have not computed the stack size before. Attempt to
         * retrieve it from either the current thread or, failing that, the
         * process accounting limit. Note that we assume that stack sizes do
         * not change throughout the lifespan of the thread/process; this is
         * almost always true.

        tsdPtr->stackDetermineResult = GetStackSize(&tsdPtr->stackSize);
        tsdPtr->initialised = 1;

But, when GetStackSize was computed using pthread_getattr_np rather than say
getrlimit this assumption is wrong for the initial thread.  There
pthread_getattr_np changes over time, as memory is mmapped/unmapped, with
RLIMIT_STACK being the upper limit for it.

So, IMHO 3) needs to be fixed and, when using pthread_getattr_np on Linux, it
should always just use getrlimit RLIMIT_STACK for the initial thread and only
use pthread_getattr_np for other threads (where it doesn't change over time).

Or, disable the broken stack checking altogether.

Comment 3 Jakub Jelinek 2007-02-04 18:53:13 UTC
Actually, pthread_getattr_np even for initial thread shouldn't hurt.
But there is a different bug in TclpCheckStackSpace:
register ptrdiff_t stackUsed;
    if (&localVar > tsdPtr->outerVarPtr) {
        stackUsed = (char *)&localVar - (char *)tsdPtr->outerVarPtr;
    } else {
        stackUsed = (char *)tsdPtr->outerVarPtr - (char *)&localVar;

     * Now we perform the actual check. Are we about to blow our stack frame?

    if (stackUsed < (ptrdiff_t) tsdPtr->stackSize) {
        STACK_DEBUG(("stack OK\tin:%p\tout:%p\tuse:%04X\tmax:%04X\n",
                &localVar, tsdPtr->outerVarPtr, stackUsed, tsdPtr->stackSize));
        return 1;
    } else {
        STACK_DEBUG(("stack OVERFLOW\tin:%p\tout:%p\tuse:%04X\tmax:%04X\n",
                &localVar, tsdPtr->outerVarPtr, stackUsed, tsdPtr->stackSize));
        return 0;

The problem is that ptrdiff_t is a signed type and if tsdPtr->stackSize
is bigger than half of the address space (or stackUsed is bigger than that),
then the comparison doesn't do what the writer meant to do.
For Linux and most other targets ptrdiff_t is the same size as size_t, only
size_t is unsigned, so guess just
-    if (stackUsed < (ptrdiff_t) tsdPtr->stackSize) {
+    if ((size_t) stackUsed < tsdPtr->stackSize) {
and a fix for TclpThreadGetStackSize return value could be enough.

Comment 4 Miloslav Trmač 2007-02-04 20:22:54 UTC
expect-5.43.0-6 built.  Jakub, thanks a lot.

Note You need to log in before you can comment on or make changes to this bug.