On Wed, Jul 16, 2014 at 11:01:58AM +0200, Werner Fink wrote:
> Hi,
> 
> with the following lines the ksh93u upto ksh93v- 2014-06-25 do hang:
> 
>   dd if=/dev/zero of=testfile.txt bs=1 count=65537
>   x=`cat testfile.txt | cat -`
> 
> ... it works with count=65536 and/or
> 
>   x=$(cat testfile.txt | cat -)
> 
> but AFAIK the backticks are very common and also supported.
> 
> Btw: Even a Ctrl-C does *not* interrupt the running ksh:
> 
>   noether:~ # strace -p 31289
>   Process 31289 attached - interrupt to quit
>   write(1, "\0", 1)                       = ? ERESTARTSYS (To be restarted)
>   --- {si_signo=SIGINT, si_code=SI_KERNEL, si_value={int=1060230178, 
> ptr=0x7f943f31d422}} (Interrupt) ---
>   rt_sigreturn(0x7d6ef8)                  = -1 EINTR (Interrupted system call)
>   write(1, "\0", 1)                       = ? ERESTARTSYS (To be restarted)

After debugging I found that the following change

---------------------------* snip *---------------------------------------
--- ksh93/src/cmd/ksh93/sh/macro.c
+++ ksh93/src/cmd/ksh93/sh/macro.c      2014-07-18 13:50:47.590235743 +0000
@@ -2198,7 +2198,7 @@ static void comsubst(Mac_t *mp,register
                mp->shp->inlineno = error_info.line+mp->shp->st.firstline;
                t = (Shnode_t*)sh_parse(mp->shp, sp,SH_EOF|SH_NL);
                mp->shp->inlineno = c;
-               type = 1;
+               type = 3;
        }
 #if KSHELL
        if(t)
---------------------------* snap *---------------------------------------

would fix the problem.  The question rises if this will cause other
problems?  AFAICS this causes that the subshell is using SH_PIPEFAIL
and a smaller buffer for stdout as well as does not wait on the job.

Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

Attachment: pgpFH2UwcHVpN.pgp
Description: PGP signature

_______________________________________________
ast-developers mailing list
ast-developers@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to