Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug in sh emulation



On Dec 9, 11:39pm, Ivan S. Freitas wrote:
} Subject: Bug in sh emulation
}
} Zsh is hanging in commands like: emulate sh -c "(echo | grep)"

Well, this is interesting.

#0  0x007067a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x007e4029 in ioctl () from /lib/tls/libc.so.6
#2  0x007e35cd in tcsetpgrp () from /lib/tls/libc.so.6
#3  0x080c5424 in attachtty (pgrp=4940) at ../../zsh-4.0/Src/utils.c:3876
#4  0x08060b66 in entersubsh (flags=6) at ../../zsh-4.0/Src/exec.c:947
#5  0x080655f0 in execcmd (state=0xbfe8e630, input=0, output=12, how=18, 
    last1=0) at ../../zsh-4.0/Src/exec.c:2832
#6  0x080628b1 in execpline2 (state=0xbfe8e630, pcode=163, how=18, input=0, 
    output=0, last1=1) at ../../zsh-4.0/Src/exec.c:1686
#7  0x08061a3e in execpline (state=0xbfe8e630, slcode=8194, how=18, last1=1)
    at ../../zsh-4.0/Src/exec.c:1424
#8  0x08061316 in execlist (state=0xbfe8e630, dont_change_job=0, exiting=1)
    at ../../zsh-4.0/Src/exec.c:1207
#9  0x08066d5c in execcmd (state=0xbfe8e630, input=0, output=0, how=18, 
    last1=2) at ../../zsh-4.0/Src/exec.c:3285
#10 0x08062690 in execpline2 (state=0xbfe8e630, pcode=131, how=18, input=0, 
    output=0, last1=0) at ../../zsh-4.0/Src/exec.c:1640
#11 0x08061a3e in execpline (state=0xbfe8e630, slcode=14338, how=18, last1=0)
    at ../../zsh-4.0/Src/exec.c:1424
#12 0x08061316 in execlist (state=0xbfe8e630, dont_change_job=1, exiting=0)
    at ../../zsh-4.0/Src/exec.c:1207
#13 0x08060dac in execode (p=0xb7cde898, dont_change_job=1, exiting=0, 
    context=0x812deb6 "eval") at ../../zsh-4.0/Src/exec.c:1028
#14 0x0805a2b0 in eval (argv=0xbfe8e7d8) at ../../zsh-4.0/Src/builtin.c:4928
#15 0x0805a568 in bin_emulate (nam=0xb7cde788 "emulate", argv=0xbfe8e7d0, 
    ops=0xbfe8e820, func=0) at ../../zsh-4.0/Src/builtin.c:5021

(rest uninteresting)

It's stuck in an infinite TTOU/CONT loop because for some reason it
wants to attachtty(), which it can't because it's not the process leader
(the parent shell still in the foreground is).

945                 setpgrp(0L, jobtab[thisjob].gleader);
946                 if (!(flags & ESUB_ASYNC))
947                     attachtty(jobtab[thisjob].gleader);

That particular code fragment dates from 2007, so that can't directly be
the problem, but I don't see any recent changes in exec.c that would have
an effect on when a job is made ASYNC.



Messages sorted by: Reverse Date, Date, Thread, Author