zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: Interrupting globs (Re: Something rotten in tar completion)
Date: Sun, 7 Dec 2014 02:42:43 +0100	[thread overview]
Message-ID: <CAHYJk3THY_=i+gnASQdt2SR7izfZw-LbmkvJ_ETOqPZkJU_5QQ@mail.gmail.com> (raw)
In-Reply-To: <141206094849.ZM1787@torch.brasslantern.com>

On Sat, Dec 6, 2014 at 6:48 PM, Bart Schaefer <schaefer@brasslantern.com> wrote:
> I was extremely busy yesterday and couldn't reply to this stuff in the
> order it was occurring, so apologies while I catch up back-to-front,
> so to speak.
>
> On Dec 6, 12:49pm, Mikael Magnusson wrote:
> } Subject: Re: Interrupting globs (Re: Something rotten in tar completion)
> }
> } >>> I suspect we'll just have to try this out and see how it works.
> } >>
> } >> This seems to work well for me in the cases you talked about, but I
> } >> quickly noticed one surprising problem. I have some stuff in my
> } >> chpwd() hook to show git branches and stuff, and these used to be
> } >> interruptible by ctrl-c (the commands are very fast with hot cache,
> } >> but can be somewhat painful with cold cache, like 5-10 seconds delay).
> } >> With the patch, I cannot interrupt them (sometimes?).
> } >>
> } > Ah, I think I understand what's happening now. Prior to the patch,
> } > pressing ctrl-c would abort out of chpwd() completely, but now it just
> } > aborts whichever single command is running. Since I have three git
> } > commands in there, I now need to press ctrl-c three times to get back
> } > to the prompt quickly. (I would like it to only require one).
>
> This is almost certainly a thinko (or a missed comparison of the value of
> errflag) somewhere in the errflag patch, as it implies that errflag is
> NOT remaining set, and I can't come up with why using a different value
> for interrupts would cause that.
>
> } Another difference: the menu completion listing could previously be
> } aborted with ctrl-c and keep the command line. It now closes the
> } listing and aborts the command line. Additionally, with menu
> } selection, you could previously ctrl-c out of selection and get to the
> } menu, ctrl-c that again, and still have the command line. Now you just
> } go straight from selection to a new empty command line.
>
> Does this happen ...
>
> (a) with the "trap ... INT" -> "TRAPINT()" change in _main_complete?  Or
>
> (b) with PWS's change to errflag?  Or
>
> (c) only with both?
>
> I suspect this is related to why I originally used the "trap" form -- I
> will have to refresh my memory, but I think having the trap run in the
> context of the caller was important in some way.  (Reset in subshells
> may also be a factor.)

It doesn't happen with only (a). It does happen with only (b). (c)
behaves the same as (b), as far as I can tell.

@@ -883,7 +883,7 @@ getbyte(long do_keytmout, int *timeout)
         die = 0;
         if (!errflag && !retflag && !breaks && !exit_pending)
             continue;
-        errflag = 0;
+        errflag &= ~ERRFLAG_ERROR;
         breaks = obreaks;
         errno = old_errno;
         return lastchar = EOF;

Undoing only this hunk fixes this for me. I can't find anything that
stops being interruptible but I only tried for a minute.


@@ -1444,12 +1444,7 @@ zwaitjob(int job, int wait_cmd)
         restore_queue_signals(q);
         return 128 + last_signal;
         }
-        /* Commenting this out makes ^C-ing a job started by a function
-           stop the whole function again.  But I guess it will stop
-           something else from working properly, we have to find out
-           what this might be.  --oberon
-
-        errflag = 0; */
+        errflag &= ~ERRFLAG_ERROR;
         if (subsh) {
         killjb(jn, SIGCONT);
         jn->stat &= ~STAT_STOPPED;

And commenting that line back out fixes my chpwd() hook ctrl-c thing.
(or changing it to errflag &= ~ERRFLAG_INT; but I have no idea if that
makes any sense).

I'll run with these two changes for a while and see if anything pops out.

-- 
Mikael Magnusson


  reply	other threads:[~2014-12-07  1:42 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 15:54 Something rotten in tar completion Peter Stephenson
2014-12-02 16:48 ` Bart Schaefer
2014-12-02 17:26   ` Peter Stephenson
2014-12-04 16:56     ` Bart Schaefer
2014-12-04 17:12       ` Peter Stephenson
2014-12-05  8:20         ` Interrupting globs (Re: Something rotten in tar completion) Bart Schaefer
2014-12-05 14:17           ` Jérémie Roquet
2014-12-06 21:50             ` Bart Schaefer
2014-12-06 22:15               ` Bart Schaefer
2014-12-05 14:50           ` Peter Stephenson
2014-12-05 15:14             ` Jérémie Roquet
     [not found]             ` <22084.1417791853@thecus.kiddle.eu>
2014-12-05 15:29               ` Peter Stephenson
2014-12-05 17:03                 ` Peter Stephenson
2014-12-05 17:53             ` Peter Stephenson
2014-12-05 18:06             ` Bart Schaefer
2014-12-05 18:13               ` Peter Stephenson
2014-12-05 20:34                 ` Peter Stephenson
2014-12-05 22:07                   ` Peter Stephenson
2014-12-06  0:32                     ` Ray Andrews
2014-12-06 22:27                       ` Bart Schaefer
2014-12-06 22:57                         ` Ray Andrews
2014-12-06  0:36                     ` Mikael Magnusson
2014-12-06  0:40                       ` Mikael Magnusson
2014-12-06 22:31                         ` Bart Schaefer
2014-12-06  0:52                       ` Mikael Magnusson
2014-12-06 11:49                         ` Mikael Magnusson
2014-12-06 17:48                           ` Bart Schaefer
2014-12-07  1:42                             ` Mikael Magnusson [this message]
2014-12-07  4:45                               ` Bart Schaefer
2014-12-07  5:04                                 ` Bart Schaefer
2014-12-07 17:39                           ` Peter Stephenson
2014-12-07 22:59                             ` Mikael Magnusson
2014-12-07  5:18                     ` Bart Schaefer
2014-12-07 17:07                       ` Peter Stephenson
2014-12-07 17:19                         ` Peter Stephenson
2014-12-08 11:18                           ` Peter Stephenson
2014-12-08 12:43                             ` Mikael Magnusson
2014-12-08 13:03                               ` Peter Stephenson
2014-12-08 15:51                                 ` Mikael Magnusson
2014-12-08 16:41                                 ` Bart Schaefer
2014-12-07 17:37                         ` Oliver Kiddle
2014-12-07 18:18                           ` Peter Stephenson
2014-12-07 18:34                         ` Bart Schaefer
2014-12-07 18:59                           ` Peter Stephenson
2014-12-07 19:58                             ` Bart Schaefer
2014-12-08 10:01                               ` Peter Stephenson
2014-12-07 20:20                             ` Peter Stephenson
2014-12-07 20:54                               ` Bart Schaefer
2014-12-07 20:03                       ` Peter Stephenson
2014-12-07  5:59                   ` Bart Schaefer
2014-12-07  7:15                     ` Mikael Magnusson
2014-12-07 16:21                     ` Peter Stephenson
2014-12-07 23:01                       ` Interrupts in completion, traps in _main_complete Bart Schaefer
2014-12-08 20:27                         ` Peter Stephenson
2014-12-09  4:43                           ` Bart Schaefer
2014-12-09 11:26                             ` Peter Stephenson
2014-12-09 11:50                               ` Peter Stephenson
2014-12-09 21:09                                 ` Peter Stephenson
2014-12-10 10:02                               ` interrupt_abort incorporation Peter Stephenson
2014-12-11 10:00                                 ` Peter Stephenson
2014-12-04 17:24       ` Something rotten in tar completion Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHYJk3THY_=i+gnASQdt2SR7izfZw-LbmkvJ_ETOqPZkJU_5QQ@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).