zsh-workers
 help / color / mirror / code / Atom feed
* SIGINT/TRAPINT Behaves Differently in 4.3.11
@ 2011-09-16  2:35 sorin.ionescu
  2011-09-16 17:17 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: sorin.ionescu @ 2011-09-16  2:35 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 724 bytes --]

Hello,

I have the following call tree: function prompt_theme_precmd() -> function git-info() -> SUBSHELL -> function git() ->  hub -> Git.

On ZSH 4.3.10, pressing CTRL + C while the above is executing calls the shell's TRAPINT function, which is the expected behaviour, but since 4.3.11, SIGINT is sent only to the executing process (Git), and the shell's TRAPINT function is no longer called.

However, pressing CTRL + C AFTER the prompt has been displayed calls TRAPINT.

Is this a bug, or is this the new expected behaviour?

This simple TRAPINT function should always be called whenever CTRL + C is pressed.

function TRAPINT() {
	echo "Inside TRAPINT"
	return $(( 128 + $1 ))
}

--
Sorin Ionescu


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: SIGINT/TRAPINT Behaves Differently in 4.3.11
  2011-09-16  2:35 SIGINT/TRAPINT Behaves Differently in 4.3.11 sorin.ionescu
@ 2011-09-16 17:17 ` Bart Schaefer
  2011-09-25 22:31   ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2011-09-16 17:17 UTC (permalink / raw)
  To: zsh-workers

On Thu, Sep 15, 2011 at 7:35 PM,  <sorin.ionescu@gmail.com> wrote:
>
> I have the following call tree: function prompt_theme_precmd() -> function git-info() -> SUBSHELL -> function git() ->  hub -> Git.
>
> On ZSH 4.3.10, pressing CTRL + C while the above is executing calls the shell's TRAPINT function, which is the expected behaviour, but since 4.3.11, SIGINT is sent only to the executing process (Git), and the shell's TRAPINT function is no longer called.
>
> However, pressing CTRL + C AFTER the prompt has been displayed calls TRAPINT.
>
> Is this a bug, or is this the new expected behaviour?

This may be related to zsh-workers/27169 and the related (extensive)
thread wherein on some platforms the shell was actually exiting on a
SIGINT received by a child process.  As you might be able to discern
from that thread, among other things it was never obvious whether some
of those changes should have been restricted to particular #ifdef
block.

Or it might not be related to that at all.

In any case the signal was likely never actually sent to the shell, it
was instead reacting to the exit status of whatever process did get
the signal.  Possibly the issue here is that now the intervening
subshell is not propagating interrupt via its exit status up to the
parent shell.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: SIGINT/TRAPINT Behaves Differently in 4.3.11
  2011-09-16 17:17 ` Bart Schaefer
@ 2011-09-25 22:31   ` Bart Schaefer
  2011-10-01 19:14     ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2011-09-25 22:31 UTC (permalink / raw)
  To: zsh-workers

On Sep 16, 10:17am, Bart Schaefer wrote:
} Subject: Re: SIGINT/TRAPINT Behaves Differently in 4.3.11
}
} On Thu, Sep 15, 2011 at 7:35 PM,  <sorin.ionescu@gmail.com> wrote:
} >
} > I have the following call tree: function prompt_theme_precmd() -> function git-info() -> SUBSHELL -> function git() -> hub -> Git.
} >
} > On ZSH 4.3.10, pressing CTRL + C while the above is executing calls
} > the shell's TRAPINT function, which is the expected behaviour, but
} > since 4.3.11, SIGINT is sent only to the executing process (Git), and
} > the shell's TRAPINT function is no longer called.

I've been doing some experiments to try to reproduce this, but I can't
make it happen.  I always get the TRAPINT called when I interrupt a job
started from precmd.

Can you be a bit more specific about that call tree?  On what operating
system / distribution are you experiencing this?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: SIGINT/TRAPINT Behaves Differently in 4.3.11
  2011-09-25 22:31   ` Bart Schaefer
@ 2011-10-01 19:14     ` Peter Stephenson
  2011-10-02 10:23       ` Julien Nicoulaud
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2011-10-01 19:14 UTC (permalink / raw)
  To: zsh-workers

On Sun, 25 Sep 2011 15:31:56 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Sep 16, 10:17am, Bart Schaefer wrote:
> } Subject: Re: SIGINT/TRAPINT Behaves Differently in 4.3.11
> }
> } On Thu, Sep 15, 2011 at 7:35 PM,  <sorin.ionescu@gmail.com> wrote:
> } >
> } > I have the following call tree: function prompt_theme_precmd() -> function git-info() -> SUBSHELL -> function git() -> hub -> Git.
> } >
> } > On ZSH 4.3.10, pressing CTRL + C while the above is executing calls
> } > the shell's TRAPINT function, which is the expected behaviour, but
> } > since 4.3.11, SIGINT is sent only to the executing process (Git), and
> } > the shell's TRAPINT function is no longer called.
> 
> I've been doing some experiments to try to reproduce this, but I can't
> make it happen.  I always get the TRAPINT called when I interrupt a job
> started from precmd.

This is as far as I got, too, but my attempts have not been remotely
exhaustive.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: SIGINT/TRAPINT Behaves Differently in 4.3.11
  2011-10-01 19:14     ` Peter Stephenson
@ 2011-10-02 10:23       ` Julien Nicoulaud
  2011-10-02 17:04         ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Julien Nicoulaud @ 2011-10-02 10:23 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1708 bytes --]

If this can help, I observed a change in the way TRAPINT behaves since
4.3.11 too. I have the following snippet in my .zshrc, which forces saving
cancelled commands to history (from some thread in zsh-users):

    TRAPINT () {
  zle && print -s -- $BUFFER
  return $1
}

Since 4.3.11, the following sequence gets the shell stuck with a "TRAPINT:1:
command not found: -s" error message:
 - Type something
 - Call _complete_help
 - <Ctrl><C>

I don't know whether this is related with sorin's one, but it used to work
fine before.

 -- Julien

2011/10/1 Peter Stephenson <p.w.stephenson@ntlworld.com>

> On Sun, 25 Sep 2011 15:31:56 -0700
> Bart Schaefer <schaefer@brasslantern.com> wrote:
> > On Sep 16, 10:17am, Bart Schaefer wrote:
> > } Subject: Re: SIGINT/TRAPINT Behaves Differently in 4.3.11
> > }
> > } On Thu, Sep 15, 2011 at 7:35 PM,  <sorin.ionescu@gmail.com> wrote:
> > } >
> > } > I have the following call tree: function prompt_theme_precmd() ->
> function git-info() -> SUBSHELL -> function git() -> hub -> Git.
> > } >
> > } > On ZSH 4.3.10, pressing CTRL + C while the above is executing calls
> > } > the shell's TRAPINT function, which is the expected behaviour, but
> > } > since 4.3.11, SIGINT is sent only to the executing process (Git), and
> > } > the shell's TRAPINT function is no longer called.
> >
> > I've been doing some experiments to try to reproduce this, but I can't
> > make it happen.  I always get the TRAPINT called when I interrupt a job
> > started from precmd.
>
> This is as far as I got, too, but my attempts have not been remotely
> exhaustive.
>
> --
> Peter Stephenson <p.w.stephenson@ntlworld.com>
> Web page now at http://homepage.ntlworld.com/p.w.stephenson/
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: SIGINT/TRAPINT Behaves Differently in 4.3.11
  2011-10-02 10:23       ` Julien Nicoulaud
@ 2011-10-02 17:04         ` Bart Schaefer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2011-10-02 17:04 UTC (permalink / raw)
  To: zsh-workers

On Oct 2, 12:23pm, Julien Nicoulaud wrote:
>
>     TRAPINT () {
>   zle && print -s -- $BUFFER
>   return $1
> }
> 
> Since 4.3.11, the following sequence gets the shell stuck with a
> "TRAPINT:1: command not found: -s" error message:
>  - Type something
>  - Call _complete_help
>  - <Ctrl><C>

Doe you imply here that _complete_help is taking a long time to run for
some reason and you therefore interrupt it?  I tried simulating that by
inserting a "sleep" into the _complete_help function ... interrupting
_complete_help results in the command line not being redrawn, but it
doesn't hang or give an error.

Or is it that you interrupt at the command line after _complete_help
finishes?  That works for me (though there may be a better way to
accomplish it now that the ZLE_LINE_ABORTED parameter can be used).

The error message seems to mean that you've somehow made the word "print"
disappear, e.g., you've got an alias for it that was defined before the
TRAPINT was defined.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-02 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-16  2:35 SIGINT/TRAPINT Behaves Differently in 4.3.11 sorin.ionescu
2011-09-16 17:17 ` Bart Schaefer
2011-09-25 22:31   ` Bart Schaefer
2011-10-01 19:14     ` Peter Stephenson
2011-10-02 10:23       ` Julien Nicoulaud
2011-10-02 17:04         ` Bart Schaefer

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).