threads / patch / 524

patch: git-merge-one-file-script use /usr/bin/env to call bash

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

## tl;dr

11 messages between May 7, 2005 and May 9, 2005. Diffs are folded; open one to read it.

replies: 10people: 6as markdown or json

Thomas Glanzmann· May 7, 2005, 08:45 UTC · lore
[PATCH]: git-merge-one-file-script use /usr/bin/env to call bash
Signed-Off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
Show changes to git-merge-one-file-script +1 −1
--- a/git-merge-one-file-script
+++ b/git-merge-one-file-script
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 #
 # This is the git merge script, called with
 #
Thomas Glanzmann· May 7, 2005, 09:05 UTC · re: Junio C Hamano · lore

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

Hello,
* Junio C Hamano <junkio@cox.net> [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 <sithglan@stud.uni-erlangen.de>
Show changes to git-merge-one-file-script +4 −4
--- 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" ;;
bert hubert· May 7, 2005, 10:03 UTC · re: Thomas Glanzmann · lore

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

On Sat, May 07, 2005 at 11:05:43AM +0200, Thomas Glanzmann wrote:
> * Junio C Hamano <junkio@cox.net> [050507 10:54]:
> > 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
Thomas Glanzmann· May 7, 2005, 10:15 UTC · re: bert hubert · lore

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

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
Junio C Hamano· May 7, 2005, 18:38 UTC · re: Thomas Glanzmann · lore

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

>>>>> "TG" == Thomas Glanzmann <sithglan@stud.uni-erlangen.de> writes:
TG> Hello,
>> You can nest $() which is valuable, unlike backtics.

TG> we're aware of this. But the specific script works perfectly fine TG> without nested simple-command redirection. So what is your point?

If that is the case then I think the patch you posted to force bash is backwards. How about changing it to use backticks?

Thomas Glanzmann· May 7, 2005, 23:15 UTC · re: Junio C Hamano · lore

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

Hello,
> If that is the case then I think the patch you posted to force
> bash is backwards.  How about changing it to use backticks?
agreed. Already did that see previous eMail.
	Thomas
Martin Waitz· May 7, 2005, 17:24 UTC · re: Thomas Glanzmann · lore

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

hoi :)
On Sat, May 07, 2005 at 11:05:43AM +0200, Thomas Glanzmann wrote:
Show 5 quoted lines
> * Junio C Hamano <junkio@cox.net> [050507 10:54]:
> > A quick question.  Which construct in this bashism?
> > Not using backtick but saying $(command)?
> 
> Exactly:
huh? which broken shell does not understand $()?
-- 
Martin Waitz
Morten Welinder· May 7, 2005, 20:22 UTC · re: Martin Waitz · lore

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

On 5/7/05, Martin Waitz <tali@admingilde.org> wrote:
Show 10 quoted lines
> hoi :)
> 
> On Sat, May 07, 2005 at 11:05:43AM +0200, Thomas Glanzmann wrote:
> > * Junio C Hamano <junkio@cox.net> [050507 10:54]:
> > > 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
Thomas Glanzmann· May 7, 2005, 23:15 UTC · re: Martin Waitz · lore

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

Hello Coworker,
> huh? which broken shell does not understand $()?
/bin/sh under Solaris 9 for example. That is where I hit it initial.
	Thomas
H. Peter Anvin· May 9, 2005, 14:47 UTC · re: Thomas Glanzmann · lore

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

Thomas Glanzmann wrote:
Show 8 quoted lines
> Hello Coworker,
> 
> 
>>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

← back to recent threads