Skip to contentSkip to conversation

trap: exit: invalid signal specification

PATCH In review S.Çağlar Onur 3 participants 5 messages Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trap: exit: invalid signal specification

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

---

git-clone.sh      2006-06-24 03:54:49.000000000 +0300 renamed from git-clone.sh 2006-06-10 22:41:54.000000000 +0300 +0 -0
diff -ur git-1.4.0.orig/git-clone.sh git-1.4.0/git-clone.sh
@@ -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" ;;

Signature · 4 lines
S.Çağlar Onur <[email protected]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
#1 lore raw
Quoted 11 lines

diff -ur git-1.4.0.orig/git-clone.sh git-1.4.0/git-clone.sh

git-clone.sh      2006-06-24 03:54:49.000000000 +0300 renamed from git-clone.sh 2006-06-10 22:41:54.000000000 +0300 +0 -0
@@ -205,7 +205,7 @@

 [ -e "$dir" ] && echo "$dir already exists." && usage mkdir -p "$dir" &&
 D=$(cd "$dir" && pwd) &&

git-clone.sh      2006-06-24 03:54:49.000000000 +0300 renamed from git-clone.sh 2006-06-10 22:41:54.000000000 +0300 +1 -1
-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?

#2 lore raw

Cumartesi 24 Haziran 2006 05:50 tarihinde, Junio C Hamano şunları yazmıştı:

Quoted 3 lines

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

Signature · 4 lines
S.Çağlar Onur <[email protected]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
#3 lore raw
Quoted 5 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
#5 lore raw
In reply to a message not in the archive

Cumartesi 24 Haziran 2006 23:11 tarihinde şunları yazmıştınız:

Quoted 2 lines

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 :(

Signature · 4 lines
S.Çağlar Onur <[email protected]>
http://cekirdek.pardus.org.tr/~caglar/

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