git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, liu.denton@gmail.com, chwarr@microsoft.com,
	garima.singh@microsoft.com
Subject: Re: [PATCH 2/3] bisect: remove CR characters from revision in replay
Date: Wed, 20 May 2020 10:08:43 -0700	[thread overview]
Message-ID: <20200520170843.GC20332@Carlos-MBP> (raw)
In-Reply-To: <xmqqzha2wt7t.fsf@gitster.c.googlers.com>

On Wed, May 20, 2020 at 07:56:22AM -0700, Junio C Hamano wrote:
> As we know that "rev" ought to consist of just hexadecimal and
> cannot be split into two at $IFS even if we don't tell "read" that
> "everything at the end of line is 'rev'", can we do
> 
> 	while read git bisect command rev ignored

that works (kind of), but will cause test t6030.66 to fail, with a git
segfault nonetheless, because we can't handle anymore a line line:

git bisect start '--term-new' 'term1' '--term-old' 'term2' '32a594a3fdac2d57cf6d02987e30eec68511498c' '88bcdc1839f0ad191ffdd65cae2a2a862d682151'

IMHO it will be probably still cleaner to do `tr -d '\015'`, even if the
patch below avoids all current issues from the testsuite.

will follow up with a fix for the segfault, unless someone else beats me to
it.

Carlo
-- >8 --
Subject: [PATCH v2] bisect: avoid tailing CR characters from revision in
 replay

6c722cbe5a (bisect: allow CRLF line endings in "git bisect replay"
input, 2020-05-07) includes CR as a field separator, but relies on
it not being included in the last field, which breaks at least when
running under OpenBSD 6.7's sh.

Instead of just assume the CR will get swallowed, read the rest of
the line into an otherwise unused variable and ignore it everywhere
except on the call for git bisect start, where it matters.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 git-bisect.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 71b367a944..08a6ed57dd 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -210,7 +210,7 @@ bisect_replay () {
 	test -r "$file" || die "$(eval_gettext "cannot read \$file for replaying")"
 	git bisect--helper --bisect-reset || exit
 	oIFS="$IFS" IFS="$IFS$(printf '\015')"
-	while read git bisect command rev
+	while read git bisect command rev tail
 	do
 		test "$git $bisect" = "git bisect" || test "$git" = "git-bisect" || continue
 		if test "$git" = "git-bisect"
@@ -223,7 +223,7 @@ bisect_replay () {
 		get_terms
 		case "$command" in
 		start)
-			cmd="bisect_start $rev"
+			cmd="bisect_start $rev $tail"
 			eval "$cmd" ;;
 		"$TERM_GOOD"|"$TERM_BAD"|skip)
 			git bisect--helper --bisect-write "$command" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit;;
-- 
2.27.0.rc0.187.gede8c892b8


  reply	other threads:[~2020-05-20 17:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20  3:44 [PATCH 0/3] openbsd: fixes for 2.27.0-RC0 Carlo Marcelo Arenas Belón
2020-05-20  3:44 ` [PATCH 1/3] t4216: avoid unnecessary subshell in test_bloom_filters_not_used Carlo Marcelo Arenas Belón
2020-05-20 15:04   ` Junio C Hamano
2020-05-20  3:44 ` [PATCH 2/3] bisect: remove CR characters from revision in replay Carlo Marcelo Arenas Belón
2020-05-20 14:56   ` Junio C Hamano
2020-05-20 17:08     ` Carlo Marcelo Arenas Belón [this message]
2020-05-20 17:14       ` Junio C Hamano
2020-05-20 20:59       ` [EXTERNAL] " Christopher Warrington (CHRISTOPHER)
2020-05-20 21:14         ` Junio C Hamano
2020-05-20  3:44 ` [PATCH 3/3] t5520: avoid alternation in grep's BRE (not POSIX) Carlo Marcelo Arenas Belón
2020-05-20 14:58   ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200520170843.GC20332@Carlos-MBP \
    --to=carenas@gmail.com \
    --cc=chwarr@microsoft.com \
    --cc=garima.singh@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=liu.denton@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).