[PATCH] git-sh-setup: fix parseopt `eval`.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 'automagic parseopt' support corrupted non option parameters
that had IFS characters in them.  The worst case can be seen
when it has a non option parameter like this:

	$1=" * some string   blech"

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---

 * I had "git pull -n . to/pic-branch" in Meta/PU which was
   affected by this bug, expanding the " * " bullet before the
   merge message that is passed from git-pull to git-merge.

   I am a bit upset because I _knew_ that the eval was wrong
   when I first saw it, but somehow I forgot about it when I
   made it land on 'next'.  My fault.

 git-sh-setup.sh |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index e1cf885..f1c4839 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -21,11 +21,12 @@ if test -n "$OPTIONS_SPEC"; then
 		exec "$0" -h
 	}
 
-	parseopt_extra=
-	[ -n "$OPTIONS_KEEPDASHDASH" ] &&
-		parseopt_extra="$parseopt_extra --keep-dashdash"
-
-	eval `echo "$OPTIONS_SPEC" | git rev-parse --parseopt $parseopt_extra -- "$@" || echo exit $?`
+	[ -n "$OPTIONS_KEEPDASHDASH" ] && parseopt_extra="--keep-dashdash"
+	parsed=$(
+		echo "$OPTIONS_SPEC" |
+		git rev-parse --parseopt $parseopt_extra -- "$@"
+	) &&
+	eval "$parsed" || exit
 else
 	usage() {
 		die "Usage: $0 $USAGE"
-- 
1.5.3.5.1617.g65b5b

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux