I hope this is how I contribute comments to an existing bug report; apologies if not!

I have had what I assume is the same problem; I initially noticed it with firefox, but have since noticed it with other programs as well (eg gnucash).  Typical manifestation:

- open Eterm with 'screen', inside of which is bash
- execute mozilla-firefox &
- press ctrl-d to close bash while firefox continues to run

This sometimes work; more often than not, however, bash does not close; I can continue to use the terminal and 'screen' as usual, but that instance of bash sits there being unresponsive. In this manifestation, bash will often end up guzzling as much CPU time as it can get it's hands on (!!).  Firefox runs just fine while all this is going on, incidentally.  Exitting it the usual way (eg ctrl-q) also finally exits the still-running bash.


Alternatively:
- open Eterm with 'screen', inside of which is bash again
- execute mozilla-firefox   (no & this time)
- press ctrl-z to suspend firefox and give me the prompt (intention: to do 'bg' and then exit)

Again, this sometimes works, and sometimes again leaves me with an apparently unusable bash shell, and a frozen (STOPped) firefox in this case.



Further observations:
- ii  bash           3.0-16         The GNU Bourne Again SHell
- Possibly not purely bash related; I could not yet reproduce the effect when doing all the same stuff from within a manually started, "second" bash (IE: open Eterm with screen and bash, start bash again, then do whatever commands).  Not sure what the differences are here; set -o 's output seems to be identical (see attachment)
- Seems unlikely, but possibly locale related?  I'm certainly also using LANG=de_DE (similar to the original poster - no @euro though, at least not when I echo $LANG); not sure about the LC_CTYPE; when I echo $LC_CTYPE I get just a blank line.  How can I get one of those 'system information' lists?

... pause ...

I had grabbed the bash source (apt-get source bash) and rebuilt the package with debug symbols and without optimsation (changes in various places in debian/rules, IIRC), and the problem just obliged by showing up (the first manifestation described above, this time with gnucash instead of firefox).  Connect with debugger and I see it's this block going around in circles, indefinitely:

2493          retry:
2494            if (wcontinued_not_supported)
2495              waitpid_flags &= ~WCONTINUED;
2496          pid = WAITPID (-1, &status, waitpid_flags);
2497          if (errno == EINVAL)
2498            {
2499              wcontinued_not_supported = 1;
2500              goto retry;

(lines 2493-2500 of jobs.c)

*awooga awooga awooga, suspicious thingie!*
errno is not explicitly reset in the listed code if the 'retry' occurs, nor is the return value of WAITPID itself checked!  My experience with errno is extremely limited, but this seems highly suspicious??
WAITPID appears to be just a wrapper for waitpid, for which man says:

""
RETURN VALUE
       waitpid():  on success, returns the process ID of the child whose state
       has changed; on error, -1 is returned; if WNOHANG was specified and  no
       child(ren)  specified by pid has yet changed state, then 0 is returned.
""

By the time it's gone into the "infinite" loop, it's always returning *0*, not -1? 


Anyway, enough of my ill-informed speculation, back to the facts as I saw them:

waitpid_flags is 3 (at least once the "infinite loop" has gotten going), corresponding to WUNTRACED | WNOHANG as presumably set on the immediately preceeding lines:

2488          waitpid_flags = (job_control && subshell_environment == 0)
2489                            ? (WUNTRACED|WCONTINUED)
2490                            : 0;
2491          if (sigchld || block == 0)
2492            waitpid_flags |= WNOHANG;

(gdb) display
5: sigchld = 1
4: block = 0
3: subshell_environment = 0
2: job_control = 1
1: waitpid_flags = 3

Complete backtrace (duck!):

#0  0x400f9018 in waitpid () from /lib/libc.so.6
#1  0x00000003 in ?? ()
#2  0x0807f0e4 in waitchld (wpid=-1, block=0) at ../bash/jobs.c:2496
#3  0x0807f059 in sigchld_handler (sig=17) at ../bash/jobs.c:2458
#4  <signal handler called>
#5  0x4011c258 in read () from /lib/libc.so.6
#6  0x0812bd88 in ?? ()
#7  0x080bb0c7 in zread (fd=3, buf=0xbfffe630 "/dev/pts/3\n", len=128)
    at ../../../bash/lib/sh/zread.c:47
#8  0x08087c00 in read_comsub (fd=3, quoted=1) at ../bash/subst.c:4181
#9  0x0808810c in command_substitute (string=0x81b6368 "tty", quoted=1)
    at ../bash/subst.c:4411
#10 0x0808cad9 in expand_word_internal (word=0x8108388, quoted=1, isexp=0,
    contains_dollar_at=0xbfffe8ec, expanded_something=0x0)
    at ../bash/subst.c:6437
#11 0x0808cf1d in expand_word_internal (word=0x8187608, quoted=0, isexp=0,
    contains_dollar_at=0x0, expanded_something=0x0) at ../bash/subst.c:6510
#12 0x08085210 in call_expand_word_internal (w=0x8187608, q=0, i=0, c=0x0,
    e=0x0) at ../bash/subst.c:2522
#13 0x080876d1 in expand_word_unsplit (word=0x8187608, quoted=0)
    at ../bash/subst.c:3774
#14 0x0806f366 in execute_case_command (case_command=0x8187768)
    at ../bash/execute_cmd.c:2196
#15 0x0806cb0c in execute_command_internal (command=0x8187688, asynchronous=0,
    pipe_in=-1, pipe_out=-1, fds_to_close=0x81876a8)
    at ../bash/execute_cmd.c:754
#16 0x080ac130 in parse_and_execute (
    string=0x812f908 "# ~/.bash_logout: executed by bash(1) when login shell exits.\n\n# when leaving the console clear the screen to increase privacy\n\ncase \"`tty`\" in\n    /dev/tty[0-9]) clear\nesac\n",
    from_file=0x812b608 "/home/michaelz/.bash_logout", flags=20)
    at ../../bash/builtins/evalstring.c:267
#17 0x080aba60 in _evalfile (filename=0x812b608 "/home/michaelz/.bash_logout",
    flags=9) at ../../bash/builtins/evalfile.c:235
#18 0x080abbe7 in maybe_execute_file (fname=0x80f2478 "~/.bash_logout",
    force_noninteractive=1) at ../../bash/builtins/evalfile.c:276
#19 0x080ac912 in bash_logout () at exit.def:147
#20 0x080ac8bf in exit_or_logout (list=0x0) at exit.def:132
#21 0x080ac760 in exit_builtin (list=0x0) at exit.def:67
#22 0x08066858 in handle_eof_input_unit () at parse.y:4513
#23 0x0805e647 in yyparse () at parse.y:386
#24 0x0805e0ef in parse_command () at ../bash/eval.c:221
#25 0x0805e1bf in read_command () at ../bash/eval.c:265
#26 0x0805df07 in reader_loop () at ../bash/eval.c:131
#27 0x0805bdb9 in main (argc=1, argv=0xbffff744, env=0xbffff74c)
    at ../bash/shell.c:704


If I can contribute anymore, please let me know!
--
Michael `Wumpus' Zinn  <[EMAIL PROTECTED]>
allexport       off
braceexpand     on
emacs           on
errexit         off
errtrace        off
functrace       off
hashall         on
histexpand      on
history         on
ignoreeof       off
interactive-comments    on
keyword         off
monitor         on
noclobber       off
noexec          off
noglob          off
nolog           off
notify          off
nounset         off
onecmd          off
physical        off
pipefail        off
posix           off
privileged      off
verbose         off
vi              off
xtrace          off










Reply via email to