git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [Breakage] Git v2.21.0-rc0 - t5318 (NonStop)

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Feb 8, 2019, 22:53 UTC
Message-ID
<006601d4c001$2de3a160$89aae420$@nexbridge.com>
In-Reply-To
<20190208223512.GA2135@sigill.intra.peff.net>
On February 8, 2019 17:35, Jeff King wrote:
Show 26 quoted lines
> On Fri, Feb 08, 2019 at 05:12:43PM -0500, Randall S. Becker wrote:
> > On February 8, 2019 17:07, brian m. carlson wrote:
> > > On Fri, Feb 08, 2019 at 02:31:57PM -0500, Jeff King wrote:
> > > > > It is available AFAIK on Linux, POSIX, and Windows under Cygwin.
> > > > > That's more than /dev/zero has anyway. I have the patch ready if
> > > > > you want it.
> > > >
> > > > Is it POSIX? Certainly truncate() is, but I didn't think the
> > > > command-line tool was. If it really is available everywhere, then
> > > > yeah, I'd be fine with it.
> > >
> > > It's not. POSIX doesn't specify the command, and macOS lacks it, I
> believe.
> >
> > I'm happy to modify the test (it is in one spot), to make a decision based
> on:
> > a) whether /dev/zero exists
> > b) whether the system is a NonStop
> > c) something else
> >
> > What would you all prefer? It doesn't matter to me one way or another,
> > as long as I can get the dependency to /dev/zero removed so tests will
> > run here.
> 
> For the case in t5318, I think we can just put the NULs in a file. Does this
> work on your platform?
Yes, should work just fine.
Show 33 quoted lines
> 
> ---
> diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh index
> 16d10ebce8..6d0ccc7eba 100755
> --- a/t/t5318-commit-graph.sh
> +++ b/t/t5318-commit-graph.sh
> @@ -383,7 +383,8 @@ corrupt_graph_and_verify() {
>  	cp $objdir/info/commit-graph commit-graph-backup &&
>  	printf "$data" | dd of="$objdir/info/commit-graph" bs=1
> seek="$pos" conv=notrunc &&
>  	dd of="$objdir/info/commit-graph" bs=1 seek="$zero_pos" count=0
> &&
> -	dd if=/dev/zero of="$objdir/info/commit-graph" bs=1
> seek="$zero_pos" count=$(($orig_size - $zero_pos)) &&
> +	gen_zero_bytes $(($orig_size - $zero_pos)) >zeroes &&
> +	dd if=zeroes of="$objdir/info/commit-graph" bs=1 seek="$zero_pos"
> &&
>  	test_must_fail git commit-graph verify 2>test_err &&
>  	grep -v "^+" test_err >err &&
>  	test_i18ngrep "$grepstr" err
> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index
> 92cf8f812c..4afab14431 100644
> --- a/t/test-lib-functions.sh
> +++ b/t/test-lib-functions.sh
> @@ -1302,3 +1302,8 @@ test_set_port () {
>  	port=$(($port + ${GIT_TEST_STRESS_JOB_NR:-0}))
>  	eval $var=$port
>  }
> +
> +# Generate an output of $1 bytes of all zeroes (NULs, not ASCII zeroes).
> +gen_zero_bytes () {
> +	perl -e 'print "\0" x $ARGV[0]' "$@"
> +}
This function does work on platform, so it's good.
> For the others that need infinite zeroes, I think using "yes" makes more
> sense, though we could also teach this function to accept an "infinity"
> parameter.
You could be sneaky about it, I suppose
+# Generate an output of $1 bytes of all zeroes (NULs, not ASCII zeroes).
+ gen_zero_bytes () {
+ 	if [ $1 -eq -1 ]; then
+ 	        yes | tr 'y' '\0'
+ 	else
+ 	        perl -e 'print "\0" x $ARGV[0]' "$@"
+ }
Or something alone those lines. It's not even slightly elegant, though. It would be better inside perl, so just
+# Generate an output of $1 bytes of all zeroes (NULs, not ASCII zeroes). If $1 is < 0, output forever.
+ gen_zero_bytes () {
+ 	perl -e ' if ($ARGV[0] < 0) { while (-1) { print "\0" } } else { print "\0" x $ARGV[0] }' "$@"
+ }

Cheers, Randall

Previous: Jeff KingNext: Jeff King
Message 19 of 25 in “[Breakage] Git v2.21.0-rc0 - t5318 (NonStop)”
  1. Randall S. BeckerFeb 8, 2019
  2. Jeff KingFeb 8, 2019
  3. Randall S. BeckerFeb 8, 2019
  4. Jeff KingFeb 8, 2019
  5. Johannes SixtFeb 8, 2019
  6. Junio C HamanoFeb 8, 2019
  7. Randall S. BeckerFeb 8, 2019
  8. Jeff KingFeb 8, 2019
  9. Randall S. BeckerFeb 8, 2019
  10. Jeff KingFeb 8, 2019
  11. Randall S. BeckerFeb 8, 2019
  12. Jeff KingFeb 8, 2019
  13. Randall S. BeckerFeb 8, 2019
  14. brian m. carlsonFeb 8, 2019
  15. Randall S. BeckerFeb 8, 2019
  16. brian m. carlsonFeb 8, 2019
  17. Randall S. BeckerFeb 8, 2019
  18. Jeff KingFeb 8, 2019
  19. Randall S. BeckerFeb 8, 2019
  20. Jeff KingFeb 9, 2019
  21. Johannes SixtFeb 9, 2019
  22. Randall S. BeckerFeb 9, 2019
  23. Jeff KingFeb 9, 2019
  24. Johannes SixtFeb 10, 2019
  25. Randall S. BeckerFeb 9, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.