# [PATCH] bisect: avoid pipes to better catch "git rev-list" errors

3 messages from 2009-03-29 to 2009-04-11. Participants: Christian Couder, Nanako Shiraishi, Junio C Hamano.
Thread: https://gitlist.dev/t/18616

## Christian Couder, 2009-03-29 09:58

Subject: [PATCH] bisect: avoid pipes to better catch "git rev-list" errors
Message-ID: <20090329115832.28acd74e.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20090329115832.28acd74e.chriscool%40tuxfamily.org

```
When doing:

eval "git rev-list --bisect-vars ..." | {
        while read line
        do
                echo "$line &&"
        done
        echo ':'
}

the result code comes from the last "echo ':'", not from running
"git rev-list --bisect-vars ...".

This means that we may miss errors from "git rev-list".

To fix that, this patch gets rid of the pipes by redirecting the
output of "git rev-list" into a file, and then reading from this
file.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git-bisect.sh |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

This applies to master.

diff --git a/git-bisect.sh b/git-bisect.sh
index e313bde..45214ca 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -284,19 +284,22 @@ filter_skipped() {
 	_skip="$2"
 
 	if [ -z "$_skip" ]; then
-		eval "$_eval" | {
+		eval "$_eval" > "$GIT_DIR/BISECT_EVAL_TMP" &&
+		{
 			while read line
 			do
 				echo "$line &&"
-			done
+			done < "$GIT_DIR/BISECT_EVAL_TMP" &&
 			echo ':'
-		}
+		} &&
+		rm -f "$GIT_DIR/BISECT_EVAL_TMP"
 		return
 	fi
 
 	# Let's parse the output of:
 	# "git rev-list --bisect-vars --bisect-all ..."
-	eval "$_eval" | {
+	eval "$_eval" > "$GIT_DIR/BISECT_EVAL_TMP" &&
+	{
 		VARS= FOUND= TRIED=
 		while read hash line
 		do
@@ -349,9 +352,10 @@ filter_skipped() {
 				    "line: '$line'"
 				;;
 			esac
-		done
+		done < "$GIT_DIR/BISECT_EVAL_TMP" &&
 		echo ':'
-	}
+	} &&
+	rm -f "$GIT_DIR/BISECT_EVAL_TMP"
 }
 
 exit_if_skipped_commits () {
-- 
1.6.2.1.404.gb0085.dirty

```

## Nanako Shiraishi, 2009-04-10 00:34

Subject: Re: [PATCH] bisect: avoid pipes to better catch "git rev-list" errors
Message-ID: <20090410093436.6117@nanako3.lavabit.com>
URL: https://gitlist.dev/e/20090410093436.6117%40nanako3.lavabit.com
In-Reply-To: <20090329115832.28acd74e.chriscool@tuxfamily.org>

```
Quoting Christian Couder:

> When doing:
> 
> eval "git rev-list --bisect-vars ..." | {
>         while read line
>         do
>                 echo "$line &&"
>         done
>         echo ':'
> }
> 
> the result code comes from the last "echo ':'", not from running
> "git rev-list --bisect-vars ...".
> 
> This means that we may miss errors from "git rev-list".
> 
> To fix that, this patch gets rid of the pipes by redirecting the
> output of "git rev-list" into a file, and then reading from this
> file.
> 
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Junio, may I ask what happened to this patch?

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

```

## Junio C Hamano, 2009-04-11 00:52

Subject: Re: [PATCH] bisect: avoid pipes to better catch "git rev-list" errors
Message-ID: <7veiw0nh9c.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7veiw0nh9c.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20090410093436.6117@nanako3.lavabit.com>

```
Nanako Shiraishi <nanako3@lavabit.com> writes:

> Quoting Christian Couder:
>
>> When doing:
>> 
>> eval "git rev-list --bisect-vars ..." | {
>>         while read line
>>         do
>>                 echo "$line &&"
>>         done
>>         echo ':'
>> }
>> 
>> the result code comes from the last "echo ':'", not from running
>> "git rev-list --bisect-vars ...".
>> 
>> This means that we may miss errors from "git rev-list".
>> 
>> To fix that, this patch gets rid of the pipes by redirecting the
>> output of "git rev-list" into a file, and then reading from this
>> file.
>> 
>> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
>
> Junio, may I ask what happened to this patch?

I've chosen to ignore it, hoping that Christian's other bisect topic to
stabilize soon.  That will make this patch unnecessary, I think.

```
