Re: subshell bug?



On Mon, 8 Dec 2003, Joe Koenig wrote:

On Mon, 8 Dec 2003, Pavel Roskin wrote:

When starting mc (from xterm/rxvt) it hangs for several (>10)
seconds.
[...]
10 seconds probably comes from feed_subshell() in src/subshell.c:

    /* we wait up to 10 seconds if fail_on_error, forever otherwise */
    wtime.tv_sec = 10;
    wtime.tv_usec = 0;

Good guess :)  I just grabbed the sources, set the value to 3,
recompiled and the delay was cut down to 3 seconds.

I actually put that code for zsh on QNX or something just as weird.

  $ bash --version
  GNU bash, version 2.05b.0(1)-release (i486-slackware-linux-gnu)
  Copyright (C) 2002 Free Software Foundation, Inc.

  $ uname -a
  Linux moo 2.4.22 #6 Tue Sep 2 17:43:01 PDT 2003 i686 unknown unknown
  GNU/Linux

But your configuration is quite common.

Further on:
The delay doesn't occur when running mc from the console. Only when
running it from X (xterm/rxvt).

To understand the role of pseudoterminals, please try running mc on the
console but from the subshell.  In other words, login on the Linux console
as ordinary user, run bash and then run mc from it.

The error only occurs when running mc as user.  When opening an xterm as
root (xterm -e su) and running mc in it, there is no delay.

Maybe you have a problem opening pseudoterminals as user.  But then the
right behavior would be to report this error and continue rather than wait
for select() to timeout.

Another possibility is that you don't have "pwd" or "kill" in your PATH
when running xterm or rxvt.  Maybe pwd is an alias?

If nothing helps, I suggest that you debug mc from a different terminal.
Put this to main():

int gdb_hold = 1;
while (gdb_hold) {
        sleep (1);
}

compile mc but don't install - it won't work.  Run it.  Run "ps x" on
another console to find process ID of mc.  Run "gdb mc" and use the
"attach" command with the process id of mc.  Use "set var gdb_hold=0" to
make mc continue, then set breakpoint on feed_subshell() by "b
feed_subshell" and continue by "c".  Once you are in feed_subshell() make
sure that subshell_pty, subshell_pipe[0] are valid (they should be
positive, different and bigger than 2).  See what happens to select() and
whether you get any input on subshell_pty and subshell_pipe[0].

-- 
Regards,
Pavel Roskin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]