From: Junio C Hamano <gitster@pobox.com>
To: Pierre Habouzit <madcoder@debian.org>
Cc: git@vger.kernel.org
Subject: [PATCH] git-sh-setup: fix parseopt `eval`.
Date: Wed, 07 Nov 2007 23:09:29 -0800 [thread overview]
Message-ID: <7vr6j15i3a.fsf@gitster.siamese.dyndns.org> (raw)
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@pobox.com>
---
* 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
next reply other threads:[~2007-11-08 7:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-08 7:09 Junio C Hamano [this message]
2007-11-08 8:15 ` [PATCH] git-sh-setup: fix parseopt `eval` Pierre Habouzit
2007-11-08 9:14 ` Pierre Habouzit
2007-11-08 9:35 ` Pierre Habouzit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vr6j15i3a.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=madcoder@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).