git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git cherry unkillable

From
ABAndrey Borzenkov <arvidjaar@mail.ru>
Date
Jan 22, 2006, 15:21 UTC
Message-ID
<200601221821.54461.arvidjaar@mail.ru>
In-Reply-To
<BAYC1-PASMTP123903F6C83FFE0EDA6284AE110@CEZ.ICE>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sunday 22 January 2006 17:51, sean wrote:
Show 16 quoted lines
> On Sun, 22 Jan 2006 06:39:04 -0500
>
> sean <seanlkml@sympatico.ca> wrote:
> > The attached patch works for me but i'm concerned about it a bit.
>
> Below is a better version that doesn't obscure the proper exit value in the
> normal case and exits with 1 if interrupted by the user.   It also ensures
> that the cleanup isn't executed twice when the script is interrupted.
>
> However, for Bash (at least) none of this is necessary; all the traps could
> just be changed to only trap 0 and the cleanup will be executed for all
> cases.   However, I don't know how compatible that is with other shells.  
> If other shells behave the same, the best fix is just to strip the 1,2,3
> and 15 from each of the existing trap lines and not bother with the patch
> given below.
>

this patch fails on zsh; trap 0 never executed after signal (SIGINT to be sure) is caught:

#!/bin/zsh

trap "exit 0" 1 2 3 15 trap "echo exiting" 0

sleep 100000000

{pts/0}% /tmp/timout.zsh ^C {pts/0}%

- -andrey
Show 59 quoted lines
> Sean
>
>
> diff --git a/git-cherry.sh b/git-cherry.sh
> index 1a62320..0b2ef1f 100755
> --- a/git-cherry.sh
> +++ b/git-cherry.sh
> @@ -49,7 +49,8 @@ ours=`git-rev-list $ours ^$limit` || exi
>  tmp=.cherry-tmp$$
>  patch=$tmp-patch
>  mkdir $patch
> -trap "rm -rf $tmp-*" 0 1 2 3 15
> +trap "rm -rf $tmp-*" 0
> +trap "exit 1" 1 2 3 15
>
>  _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
>  _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
> diff --git a/git-format-patch.sh b/git-format-patch.sh
> index 7e67c4e..6ba6339 100755
> --- a/git-format-patch.sh
> +++ b/git-format-patch.sh
> @@ -77,7 +77,8 @@ tt)
>  esac
>
>  tmp=.tmp-series$$
> -trap 'rm -f $tmp-*' 0 1 2 3 15
> +trap "rm -f $tmp-*" 0
> +trap "exit 1" 1 2 3 15
>
>  series=$tmp-series
>  commsg=$tmp-commsg
> diff --git a/git-ls-remote.sh b/git-ls-remote.sh
> index f699268..7dc224b 100755
> --- a/git-ls-remote.sh
> +++ b/git-ls-remote.sh
> @@ -38,7 +38,8 @@ peek_repo="$(get_remote_url "$@")"
>  shift
>
>  tmp=.ls-remote-$$
> -trap "rm -fr $tmp-*" 0 1 2 3 15
> +trap "rm -rf $tmp-*" 0
> +trap "exit 1" 1 2 3 15
>  tmpdir=$tmp-d
>
>  case "$peek_repo" in
> diff --git a/git-reset.sh b/git-reset.sh
> index 6c9e58a..166b635 100755
> --- a/git-reset.sh
> +++ b/git-reset.sh
> @@ -4,7 +4,8 @@ USAGE='[--mixed | --soft | --hard]  [<co
>  . git-sh-setup
>
>  tmp=${GIT_DIR}/reset.$$
> -trap 'rm -f $tmp-*' 0 1 2 3 15
> +trap "rm -f $tmp-*" 0
> +trap "exit 1" 1 2 3 15
>
>  reset_type=--mixed
>  case "$1" in
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD06MSR6LMutpd94wRApgAAJ0e0AUIS83XTa4BA1rEY1XriHKZmQCgnXZd 1sElZOLAgyuxgi3EHiaMGFc= =xwjP -----END PGP SIGNATURE-----

Previous: seanNext: sean
Message 4 of 7 in “git cherry unkillable”
  1. Andrey BorzenkovJan 22, 2006
  2. seanJan 22, 2006
  3. seanJan 22, 2006
  4. Andrey BorzenkovJan 22, 2006
  5. seanJan 22, 2006
  6. seanJan 22, 2006
  7. Andrey BorzenkovJan 22, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.