A vanilla build of ksh93 2008-11-04 on Darwin 10.5 is not capable of
foregrounding a job
without it immediately backgrounded.
$ sleep 10
^Z[1] + Stopped sleep 10
$ fg
sleep 10
[1] + Stopped process continued sleep 10
The sleep will eventually finish but anything that reads from the tty
will block.
If you #undef/define WCONTINUED 0 then ksh stops foregrounding itself.
ksh is calling waitpid with WCONTINUED|WNOHANG and seems to be
expecting -1 when the pid is no longer WCONTINUED
Darwin reports 0 and ksh foregrounds itself.
For kicks I tried
$ (read foo)
^z
fg
and ksh died
Thread 0 Crashed:
0 libSystem.B.dylib 0x92071b9e __kill + 10
1 ksh 0x0002de07 sh_done + 679
2 ksh 0x0002c984 sh_fault + 937
3 libSystem.B.dylib 0x9207009b _sigtramp + 43
4 ??? 0xffffffff 0 + 4294967295
5 ksh 0x0006ba47 sh_assignok + 235
6 ksh 0x00052458 nv_putval + 181
7 ksh 0x0002c695 sh_fault + 186
8 ksh 0x000290ba ed_setup + 213
9 ksh 0x000793a8 ed_emacsread + 328
10 ksh 0x000398b0 slowread + 413
11 ksh 0x000e63a2 sfrd + 1272
12 ksh 0x000e0551 _sffilbuf + 990
13 ksh 0x000e71b7 sfreserve + 1306
14 ksh 0x00016532 exfile + 2476
15 ksh 0x00015b60 sh_main + 3308
16 ksh 0x00001bca main + 44
17 ksh 0x00001b72 start + 54
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers