Oh, the problem appears to be that read(2) and write(2) do not
abort with EINTR if the respective devices are fast enough ☹

Please try this patch:

Index: funcs.c
===================================================================
RCS file: /cvs/src/bin/mksh/funcs.c,v
retrieving revision 1.305
diff -u -p -r1.305 funcs.c
--- funcs.c     1 Aug 2016 21:38:02 -0000       1.305
+++ funcs.c     25 Aug 2016 16:19:19 -0000
@@ -3776,12 +3776,15 @@ c_cat(const char **wp)
                                /* end of file reached */
                                break;
                        while (n) {
+                               if (intrsig)
+                                       goto has_intrsig;
                                if ((w = write(STDOUT_FILENO, cp, n)) != -1) {
                                        n -= w;
                                        cp += w;
                                        continue;
                                }
                                if (errno == EINTR) {
+ has_intrsig:
                                        restore_pipe(opipe);
                                        /* give the user a chance to ^C out */
                                        intrcheck();


** Changed in: mksh
   Importance: Undecided => Low

** Changed in: mksh
       Status: Confirmed => Fix Committed

** Changed in: mksh
     Assignee: (unassigned) => Thorsten Glaser (mirabilos)

-- 
You received this bug notification because you are a member of mksh
Mailing List, which is subscribed to mksh.
Matching subscriptions: mkshlist-to-mksh-bugmail
https://bugs.launchpad.net/bugs/1616692

Title:
  ^C doesn't interrupt cat builtin when reading from /dev/zero

Status in mksh:
  Fix Committed

Bug description:
  bash$ ./mksh 
  $ cat < /dev/zero > /dev/null 
  ^C^C^C^C^C^C^C

To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1616692/+subscriptions

Reply via email to