t5562: do not depend on /dev/zero
diff mbox series

Message ID 20190215164237.12250-1-max@max630.net
State New
Headers show
Series
  • t5562: do not depend on /dev/zero
Related show

Commit Message

Max Kirillov Feb. 15, 2019, 4:42 p.m. UTC
It was reported [1] that NonStop platform does not have /dev/zero.

The test uses /dev/zero as a dummy input. Passing case (http-backed
failed because of too big input size) should not be reading anything
from it. If http-backend would erroneously try to read any data
returning EOF probably would be even safer than providing some
meaningless data.

Replace /dev/zero with /dev/null to avoid issues with platforms which do
not have /dev/zero.

[1] https://public-inbox.org/git/20190209185930.5256-4-randall.s.becker@rogers.com/

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Max Kirillov <max@max630.net>
---
By the way, I don't think this requires such sofisticated
fix. In the success case the input would not be read at all.
You could replace it with /dev/null, the in failure (not 
immediate fail) git would fail due to truncated input or
something.

Also, as you experience hang issue [2] in earlier tests, this 
one should not have contributed to it.

[2] https://public-inbox.org/git/001901d4c22b$194bfe60$4be3fb20$@nexbridge.com/
 t/t5562-http-backend-content-length.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Randall S. Becker Feb. 15, 2019, 5:13 p.m. UTC | #1
On February 15, 2019 11:43, Max Kirillov wrote:
> It was reported [1] that NonStop platform does not have /dev/zero.
> 
> The test uses /dev/zero as a dummy input. Passing case (http-backed failed
> because of too big input size) should not be reading anything from it. If
http-
> backend would erroneously try to read any data returning EOF probably
> would be even safer than providing some meaningless data.
> 
> Replace /dev/zero with /dev/null to avoid issues with platforms which do
not
> have /dev/zero.
> 
> [1] https://public-inbox.org/git/20190209185930.5256-4-
> randall.s.becker@rogers.com/
> 
> Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
> Signed-off-by: Max Kirillov <max@max630.net>
> ---
> By the way, I don't think this requires such sofisticated fix. In the
success
> case the input would not be read at all.
> You could replace it with /dev/null, the in failure (not immediate fail)
git
> would fail due to truncated input or something.
> 
> Also, as you experience hang issue [2] in earlier tests, this one should
not
> have contributed to it.
> 
> [2] https://public-
> inbox.org/git/001901d4c22b$194bfe60$4be3fb20$@nexbridge.com/
>  t/t5562-http-backend-content-length.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/t/t5562-http-backend-content-length.sh
b/t/t5562-http-backend-
> content-length.sh
> index 90d890d02f..436c261c86 100755
> --- a/t/t5562-http-backend-content-length.sh
> +++ b/t/t5562-http-backend-content-length.sh
> @@ -150,7 +150,7 @@ test_expect_success 'CONTENT_LENGTH overflow
> ssite_t' '
>  		GIT_HTTP_EXPORT_ALL=TRUE \
>  		REQUEST_METHOD=POST \
>  		CONTENT_LENGTH="$NOT_FIT_IN_SSIZE" \
> -		git http-backend </dev/zero >/dev/null 2>err &&
> +		git http-backend </dev/null >/dev/null 2>err &&
>  	grep "fatal:.*CONTENT_LENGTH" err

FTR, this particular subtest is not the one that is hanging. This subtest
passes on NonStop with any and all (now) 4 solutions that have been floating
around.

Cheers,
Randall
Junio C Hamano Feb. 15, 2019, 6 p.m. UTC | #2
"Randall S. Becker" <rsbecker@nexbridge.com> writes:

> FTR, this particular subtest is not the one that is hanging. This subtest
> passes on NonStop with any and all (now) 4 solutions that have been floating
> around.

One thing I'd like to know more is if this test passes on NonStop
with this patch, i.e. /dev/zero replaced with /dev/null.

Thanks.
Randall S. Becker Feb. 15, 2019, 6:10 p.m. UTC | #3
On February 15, 2019 13:01, Junio C Hamano wrote:
> To: Randall S. Becker <rsbecker@nexbridge.com>
> Cc: 'Max Kirillov' <max@max630.net>; git@vger.kernel.org; 'Johannes
> Schindelin' <Johannes.Schindelin@gmx.de>
> Subject: Re: [PATCH] t5562: do not depend on /dev/zero
> 
> "Randall S. Becker" <rsbecker@nexbridge.com> writes:
> 
> > FTR, this particular subtest is not the one that is hanging. This
> > subtest passes on NonStop with any and all (now) 4 solutions that have
> > been floating around.
> 
> One thing I'd like to know more is if this test passes on NonStop with
this
> patch, i.e. /dev/zero replaced with /dev/null.

Yes, this particular subtest passes replacing /dev/null. The other three
subtests still hang. This subtest never did.
Junio C Hamano Feb. 15, 2019, 6:45 p.m. UTC | #4
"Randall S. Becker" <rsbecker@nexbridge.com> writes:

> On February 15, 2019 13:01, Junio C Hamano wrote:
>> To: Randall S. Becker <rsbecker@nexbridge.com>
>> Cc: 'Max Kirillov' <max@max630.net>; git@vger.kernel.org; 'Johannes
>> Schindelin' <Johannes.Schindelin@gmx.de>
>> Subject: Re: [PATCH] t5562: do not depend on /dev/zero
>> 
>> "Randall S. Becker" <rsbecker@nexbridge.com> writes:
>> 
>> > FTR, this particular subtest is not the one that is hanging. This
>> > subtest passes on NonStop with any and all (now) 4 solutions that have
>> > been floating around.
>> 
>> One thing I'd like to know more is if this test passes on NonStop with
> this
>> patch, i.e. /dev/zero replaced with /dev/null.
>
> Yes, this particular subtest passes replacing /dev/null. The other three
> subtests still hang. This subtest never did.

Thanks.

Patch
diff mbox series

diff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh
index 90d890d02f..436c261c86 100755
--- a/t/t5562-http-backend-content-length.sh
+++ b/t/t5562-http-backend-content-length.sh
@@ -150,7 +150,7 @@  test_expect_success 'CONTENT_LENGTH overflow ssite_t' '
 		GIT_HTTP_EXPORT_ALL=TRUE \
 		REQUEST_METHOD=POST \
 		CONTENT_LENGTH="$NOT_FIT_IN_SSIZE" \
-		git http-backend </dev/zero >/dev/null 2>err &&
+		git http-backend </dev/null >/dev/null 2>err &&
 	grep "fatal:.*CONTENT_LENGTH" err
 '