Re: [PATCH]: git-merge-one-file-script use /usr/bin/env to call bash

8 messages, 6 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH]: git-merge-one-file-script use /usr/bin/env to call bash

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:41:56

A quick question.  Which construct in this bashism?
Not using backtick but saying $(command)?

[PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

From: Thomas Glanzmann <hidden>
Date: 2016-06-15 22:41:56

Hello,

* Junio C Hamano [off-list ref] [050507 10:54]:
A quick question.  Which construct in this bashism?
Not using backtick but saying $(command)?
Exactly:

	(faui04a) [~/work/git/git-solaris] git pull
	head => 46dd99f970d283dc0de440c06fca8f4586b70548
	remote => e7d3dd248f50501f98b29c917e70bddcf3ea925a
	base => 74c7cfa875448c71a18d21a0cc7c973afe759fa5
	Documentation/core-git.txt: unmerged (8bd893197e6e769b6e03ca1206e355214e16d56a)
	local-pull.c: unmerged (4f52bca48c390e8113b3695a53ce62e0c23278a8)
	local-pull.c: unmerged (a8af725467cde6653160511e468a1fda4e004503)
	local-pull.c: unmerged (1eec8927dbfa3af934651b25ded738d192706286)
	sha1_file.c: unmerged (e6ce455ae90bd430f2128f454bdb6e0575412486)
	sha1_file.c: unmerged (7887b6481ae5c9368a24bf053f79dbbc1f039300)
	sha1_file.c: unmerged (f1c1c70d784aa0587cd4c7143c3d464fd8e5ddc6)
	fatal: write-tree: not able to write tree

This is it:
	/home/cip/adm/sithglan/work/git/bin/git-SunOS/bin/git-merge-one-file-script: syntax error at line 55: `orig=$' unexpected
	fatal: merge program failed
	git-merge-cache failed: child exit value: 1 at /home/cip/adm/sithglan/work/git/yagf/git line 1015.

The attached patch at the end of this eMail fixes it for me *without*
touching /bin/sh in the bang:

	(faui04a) [~/work/git/git-solaris] git pull
	head => 46dd99f970d283dc0de440c06fca8f4586b70548
	remote => e7d3dd248f50501f98b29c917e70bddcf3ea925a
	base => 74c7cfa875448c71a18d21a0cc7c973afe759fa5
	Documentation/core-git.txt: unmerged (8bd893197e6e769b6e03ca1206e355214e16d56a)
	local-pull.c: unmerged (4f52bca48c390e8113b3695a53ce62e0c23278a8)
	local-pull.c: unmerged (a8af725467cde6653160511e468a1fda4e004503)
	local-pull.c: unmerged (1eec8927dbfa3af934651b25ded738d192706286)
	sha1_file.c: unmerged (e6ce455ae90bd430f2128f454bdb6e0575412486)
	sha1_file.c: unmerged (7887b6481ae5c9368a24bf053f79dbbc1f039300)
	sha1_file.c: unmerged (f1c1c70d784aa0587cd4c7143c3d464fd8e5ddc6)
	fatal: write-tree: not able to write tree
	Threewaydiff invloved.

[PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

Signed-Off-by: Thomas Glanzmann <redacted>
--- a/git-merge-one-file-script
+++ b/git-merge-one-file-script
@@ -52,9 +52,9 @@
 #
 "$1$2$3")
 	echo "Auto-merging $4."
-	orig=$(git-unpack-file $1)
-	src1=$(git-unpack-file $2)
-	src2=$(git-unpack-file $3)
+	orig=`git-unpack-file $1`
+	src1=`git-unpack-file $2`
+	src2=`git-unpack-file $3`
 	merge "$src2" "$orig" "$src1"
 	ret=$?
 	if [ "$6" != "$7" ]; then
@@ -64,7 +64,7 @@
 		echo "ERROR: Leaving conflict merge in $src2."
 		exit 1
 	fi
-	sha1=$(git-write-blob "$src2") || {
+	sha1=`git-write-blob "$src2"` || {
 		echo "ERROR: Leaving conflict merge in $src2."
 	}
 	exec git-update-cache --add --cacheinfo "$6" $sha1 "$4" ;;

Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

From: bert hubert <hidden>
Date: 2016-06-15 22:41:56

On Sat, May 07, 2005 at 11:05:43AM +0200, Thomas Glanzmann wrote:
* Junio C Hamano [off-list ref] [050507 10:54]:
quoted
A quick question.  Which construct in this bashism?
Not using backtick but saying $(command)?
You can nest $() which is valuable, unlike backtics.

-- 
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://netherlabs.nl              Open and Closed source services

Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

From: Thomas Glanzmann <hidden>
Date: 2016-06-15 22:41:56

Hello,
You can nest $() which is valuable, unlike backtics.
we're aware of this. But the specific script works perfectly fine
without nested simple-command redirection. So what is your point?

	Thomas

Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

From: Martin Waitz <hidden>
Date: 2016-06-15 22:41:56

hoi :)

On Sat, May 07, 2005 at 11:05:43AM +0200, Thomas Glanzmann wrote:
* Junio C Hamano [off-list ref] [050507 10:54]:
quoted
A quick question.  Which construct in this bashism?
Not using backtick but saying $(command)?
Exactly:
huh? which broken shell does not understand $()?

-- 
Martin Waitz

Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

From: Morten Welinder <hidden>
Date: 2016-06-15 22:41:56

On 5/7/05, Martin Waitz [off-list ref] wrote:
hoi :)

On Sat, May 07, 2005 at 11:05:43AM +0200, Thomas Glanzmann wrote:
quoted
* Junio C Hamano [off-list ref] [050507 10:54]:
quoted
A quick question.  Which construct in this bashism?
Not using backtick but saying $(command)?
Exactly:
huh? which broken shell does not understand $()?
Solaris' /bin/sh

I thought everything we were relying on bash anyway.  It'll take it.

Morten

Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

From: Thomas Glanzmann <hidden>
Date: 2016-06-15 22:41:56

Hello Coworker,
huh? which broken shell does not understand $()?
/bin/sh under Solaris 9 for example. That is where I hit it initial.

	Thomas

Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:41:56

Thomas Glanzmann wrote:
Hello Coworker,

quoted
huh? which broken shell does not understand $()?

/bin/sh under Solaris 9 for example. That is where I hit it initial.
Shoot Sun.

$(...) is in POSIX and has been for oh, what, 15 years now?

	-hpa
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help