I've been having trouble running "package make" with the newly
compiled and installed ksh-20120929; i.e., "package make" would hang
after producing just a few lines of screen output. Perhaps the fact that
I'm piping the output of "package make" to tee has something to do with
it. Ksh-20120612 didn't seem to have any trouble with the first build,
although I didn't pipe that build though tee. To get around the problem
I used bash to run "package make" on subsequent builds.

    However, I finally decided to take a closer look at the hang with
tracing turned on. The last command I saw before the hang was "exec
2>/dev/null". So, I typed "exec 2>/dev/null" at the command prompt, and
sure enough the shell hung. But, this was a harder hang than with
"package make". Control-c wouldn't stop it. I had to open another window
and kill the hung shell with SIGKILL. The system load remained low
through the hang, so it didn't appear to be an infinite loop.

    In an attempt to confirm that this is a new problem with
ksh-20140929 I started ksh-20120612 and typed "exec 2>/dev/null" at the
command prompt. But, that version of the shell hung, too. I tried this
with all the versions of ksh I have, and they all hung. This no longer
seemed exemplary of the problem with "package make", so I decided to try
it with bash. Even bash hung. Then, I tried zsh. Zsh was the only shell
that didn't hang.

    The fact that bash hung makes it clear that, whatever's going wrong
in interactive mode, it's not the same problem that's occurring with
"package make". So, I tried reproducing the "package make" hang through
a shell script. But, a simple shell script with "exec 2>/dev/null" in it
succeeds with no hang. I even tried piping the test script's output
through tee -- no hang.

    I couldn't think of anything more to try other than using the
ksh-20140929 built with debug=1 to produce a back-trace from the point
of the hang(s). This was fairly straightforward with the interactive
hang. The back trace is attached as interactive_back_trace.txt. It was a
little more tricky for the "package make" hang. Here's what I did there:

$ mkdir /tmp/build
$ export INSTALLROOT=/tmp/build
$ cd "$PACKAGEROOT"
$ PATH=${PWD}/bin:$PATH
$ cd arch/darwin.ppc/bin
$ gdb ./ksh
(gdb) r -x package make
# Note: no pipe through tee.
# Wait for the following trace output:
+ exec
+ 2>/dev/null
^C
Program received signal SIGINT, Interrupt.
...
(gdb) where

This back trace is attached as package_make_back_trace.txt. The
differences between these two back traces makes it clear that these are
two separate bugs.

    It's interesting that bash has the interactive bug. I'm using bash
version 4.3.30(5)-release.

    Here are a couple more bits of information about the interactive hang:

        exec 2>&-            # Causes the same hang with the same back
trace.
        exec >/dev/null    # Succeeds. No hang.
        exec >&-            # Succeeds. No hang.

Could this indicate that this is a buffering problem since stderr is
character-buffered and stdout is line buffered?

                    Terrence Doyle
#0  0x91fc28f8 in read$UNIX2003 ()
#1  0x001d9404 in sfpkrd (fd=0, argbuf=0x1722dc0, n=32768, rc=10, tm=-1, 
action=1) at /Source/AST/2014-09-29/src/lib/libast/sfio/sfpkrd.c:296
#2  0x00046880 in ed_read (context=0x1735fc0, fd=0, buff=0x1722dc0 "", 
size=32768, reedit=0) at /Source/AST/2014-09-29/src/cmd/ksh93/edit/edit.c:892
#3  0x000d5468 in ed_viread (context=0x1735fc0, fd=0, shbuf=0x1722dc0 "", 
nchar=32768, reedit=0) at /Source/AST/2014-09-29/src/cmd/ksh93/edit/vi.c:353
#4  0x00064dd8 in slowread (iop=0x269f20, buff=0x1722dc0, size=32768, 
handle=0x1732dd0) at /Source/AST/2014-09-29/src/cmd/ksh93/sh/io.c:2123
#5  0x001de0e0 in sfrd (f=0x269f20, buf=0x1722dc0, n=32768, disc=0x1732dd0) at 
/Source/AST/2014-09-29/src/lib/libast/sfio/sfrd.c:259
#6  0x001d35a0 in _sffilbuf (f=0x269f20, n=-1) at 
/Source/AST/2014-09-29/src/lib/libast/sfio/sffilbuf.c:105
#7  0x001df4d0 in sfreserve (f=0x269f20, size=0, type=0) at 
/Source/AST/2014-09-29/src/lib/libast/sfio/sfreserve.c:148
#8  0x00022bf8 in exfile (shp=0x266124, iop=0x#8  0x00022bf8 in exfile 
(shp=0x266124, iop=0x#8  0x00022bf8 in exfile (shp=0x22#8  0x00022bf8 in exfile 
(shp=0x266124, iop=0x#8  0x00022bf8 in exfile (shp=0x/cmd/ksh93/sh/main.c:382
#10 0x00001a5c in main (argc=1, argv=0xbfffee78) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/pmain.c:45
#0  0x91fc28fc in read$UNIX2003 ()
#1  0x001de324 in sfrd (f=0x20ecf90, buf=0x177ba00, n=32768, disc=0x1731650) at 
/Source/AST/2014-09-29/src/lib/libast/sfio/sfrd.c:279
#2  0x00064b64 in piperead (iop=0x20ecf90, buff=0x177ba00, size=32768, 
handle=0x1731650) at /Source/AST/2014-09-29/src/cmd/ksh93/sh/io.c:2086
#3  0x001de0e0 in sfrd (f=0x20ecf90, buf=0x177ba00, n=32768, disc=0x1731650) at 
/Source/AST/2014-09-29/src/lib/libast/sfio/sfrd.c:259
#4  0x001d35a0 in _sffilbuf (f=0x20ecf90, n=32768) at 
/Source/AST/2014-09-29/src/lib/libast/sfio/sffilbuf.c:105
#5  0x001df4d0 in sfreserve (f=0x20ecf90, size=-1, type=0) at 
/Source/AST/2014-09-29/src/lib/libast/sfio/sfreserve.c:148
#6  0x00082c00 in comsubst (mp=0x1736720, t=0x20ff2a0, type=1) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/macro.c:2273
#7  0x0007abd0 in copyto (mp=0x1736720, endch=0, newquote=0) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/macro.c:602
#8  0x00078a4c in sh_mactrim (shp=0x266124, str=0x176e609 "i=`$1 2>/dev/null | 
grep -c \"$2\"`", mode=-1) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/macro.c:182
#9  0x00086480 in sh_setlist (shp=0x266124, arg=0x176e600, flags=131584, 
typ=0x0) at /Source/AST/2014-09-29/src/cmd/ksh93/sh/name.c:342
#10 0x000beb88 in sh_exec (shp=0x266124, t=0x176e630, flags=516) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:1188
#11 0x000c298c in sh_exec (shp=0x266124, t=0x176e950, flags=516) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2270
#12 0x000c371c in sh_exec (shp=0x266124, t=0x176e440, flags=516) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2518
#13 0x000c298c in sh_exec (shp=0x266124, t=0x1770320, flags=516) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2270
#14 0x000c3ea4 in sh_exec (shp=0x266124, t=0x176dd20, flags=516) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2642
#15 0x000c3120 in sh_exec (shp=0x266124, t=0x176dc50, flags=4) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2418
#16 0x000c298c in sh_exec (shp=0x266124, t=0x1762740, flags=4) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2270
#17 0x0000aba4 in b_dot_cmd (n=0, argv=0x205d4d8, context=0x266708) at 
/Source/AST/2014-09-29/src/cmd/ksh93/bltins/misc.c:289
#18 0x000c6d40 in sh_funct (shp=0x266124, np=0x1758960, argn=2, argv=0x205d4d8, 
envlist=0x0, execflg=4) at /Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:3427
#19 0x000c0508 in sh_exec (shp=0x266124, t=0x205d480, flags=4) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:1592
#20 0x000c298c in sh_exec (shp=0x266124, t=0x205d770, flags=4) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2270
#21 0x000c3ea4 in sh_exec (shp=0x266124, t=0x205d450, flags=4) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2642
#22 0x000c298c in sh_exec (shp=0x266124, t=0x179a9a0, flags=4) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2270
#23 0x000c3ea4 in sh_exec (shp=0x266124, t=0x2134fb0, flags=4) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/xec.c:2642
#24 0x00022fc8 in exfile (shp=0x266124, iop=0x1734650, fno=11) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/main.c:610
#25 0x00022264 in sh_main (ac=4, av=0xbfffee6c, userinit=0) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/main.c:382
#26 0x00001a5c in main (argc=4, argv=0xbfffee6c) at 
/Source/AST/2014-09-29/src/cmd/ksh93/sh/pmain.c:45
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to