threads / patch / 4645

patchtrap: exit: invalid signal specification

Subject: [Patch] trap: exit: invalid signal specification

## tl;dr

5 messages between Jun 24, 2006 and Jun 25, 2006. Diffs are folded; open one to read it.

replies: 4people: 3as markdown or json

S.Çağlar Onur· Jun 24, 2006, 01:10 UTC · lore
Hi;
This tiny patch is needed to solve

caglar@zangetsu ~ $ git-clone /usr/bin/git-clone: line 121: trap: exit: invalid signal specification

error under tr_TR.UTF-8 (and other Turkic locales). For these locales upper(i) != I .

P.S: If needed please CC me, i'm not subscribed to list
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---

diff -ur git-1.4.0.orig/git-clone.sh git-1.4.0/git-clone.sh --- git-1.4.0.orig/git-clone.sh 2006-06-10 22:41:54.000000000 +0300 +++ git-1.4.0/git-clone.sh      2006-06-24 03:54:49.000000000 +0300

Show changes to diff +1 −1
@@ -205,7 +205,7 @@
 [ -e "$dir" ] && echo "$dir already exists." && usage
 mkdir -p "$dir" &&
 D=$(cd "$dir" && pwd) &&
-trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0
+trap 'err=$?; cd ..; rm -r "$D"; EXIT $err' 0
 case "$bare" in
 yes)
        GIT_DIR="$D" ;;
-- 
S.Çağlar Onur <caglar@pardus.org.tr>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
Junio C Hamano· Jun 24, 2006, 02:50 UTC · re: S.Çağlar Onur · lore

Re: [Patch] trap: exit: invalid signal specification

Show 11 quoted lines
> diff -ur git-1.4.0.orig/git-clone.sh git-1.4.0/git-clone.sh
> --- git-1.4.0.orig/git-clone.sh 2006-06-10 22:41:54.000000000 +0300
> +++ git-1.4.0/git-clone.sh      2006-06-24 03:54:49.000000000 +0300
> @@ -205,7 +205,7 @@
>  [ -e "$dir" ] && echo "$dir already exists." && usage
>  mkdir -p "$dir" &&
>  D=$(cd "$dir" && pwd) &&
> -trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0
> +trap 'err=$?; cd ..; rm -r "$D"; EXIT $err' 0
>  case "$bare" in
>  yes)

I am not quite sure what to make out this... Do you mean your shell does not like the command "exit" spelled in lowercase under Turkic locale?

S.Çağlar Onur· Jun 24, 2006, 12:54 UTC · re: Junio C Hamano · lore

Re: [Patch] trap: exit: invalid signal specification

Cumartesi 24 Haziran 2006 05:50 tarihinde, Junio C Hamano şunları yazmıştı: 
> I am not quite sure what to make out this...  Do you mean your
> shell does not like the command "exit" spelled in lowercase
> under Turkic locale?

Sorry to not clear enough previously, for Turkic locales (tr_TR, az_AZ etc.) upper(i) != I. More detailed analysis can be found at http://www.i18nguy.com/unicode/turkish-i18n.html, "Why Applications Fail With The Turkish Language" section. This is the main reason of this problem.

According to its man page signals defined with uppercase letters but also different trap implementations may permit lowercase signal names as an extension.

As an example bash (v. 3.1.17) permits lowercase signal names but it converts this lowercase signal names into uppercase ones while interpreting the script. But for our "Turkish has 4 letter "I"s" problem this convert to uppercase one process fails but for bash invalid signal names not be considered a syntax error and do not cause the shell to abort.

Yours
-- 
S.Çağlar Onur <caglar@pardus.org.tr>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
Matthias Lederhofer· Jun 24, 2006, 16:57 UTC · re: S.Çağlar Onur · lore

Re: [Patch] trap: exit: invalid signal specification

Show 5 quoted lines
> As an example bash (v. 3.1.17) permits lowercase signal names but it converts 
> this lowercase signal names into uppercase ones while interpreting the 
> script. But for our "Turkish has 4 letter "I"s" problem this convert to 
> uppercase one process fails but for bash invalid signal names not be 
> considered a syntax error and do not cause the shell to abort. 

It is ``trap <action> <signal>'' so for the signal part this may be right that this is made uppercase. But action is not modified I guess. So it should be exit because there is no built-in named EXIT in bash:

$ type exit exit is a shell builtin $ type EXIT bash: type: EXIT: not found

So for me it does not seem to work:

$ trap 'err=$?; echo trap; EXIT $?' 0 $ exit 5 exit trap bash: EXIT: command not found [1] 12906 exit 5 bash

S.Çağlar Onur· Jun 25, 2006, 14:33 UTC · lore

Re: [Patch] trap: exit: invalid signal specification

Cumartesi 24 Haziran 2006 23:11 tarihinde şunları yazmıştınız:
> But in the commandline you are patching,  'exit' keyword
> is not bash signal name, 

Pff, you are completely right. I'm currently using git-1.2.6 which has "exit" signal (git-clone.sh: trap 'err=$?; cd ..; rm -r "$D"; exit $err' exit ) causing that trouble but in git-1.4.0 its converted to 0 (git-clone.sh: trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0) and i didn't realize until look again. Sorry for noise :(

-- 
S.Çağlar Onur <caglar@pardus.org.tr>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!

← back to recent threads