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

2019-02-10 Thread Johannes Sixt
Am 10.02.19 um 00:29 schrieb Jeff King:
> On Sat, Feb 09, 2019 at 09:39:43AM +0100, Johannes Sixt wrote:
>>  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)) &&
>> +printf "%0*d" $(($orig_size - $zero_pos)) 0 | tr 0 '\0' |
>> +dd of="$objdir/info/commit-graph" bs=1 seek="$zero_pos" &&
> 
> Using stdin instead of the tmpfile is nice, and shouldn't have any
> problems. I do think your printf suggestion looks nice, but I wondered
> if it might run into portability issues (not because of anything in
> particular, but I often find that the more clever a shell solution, the
> more likely we run into obscure problems).
> 
> But if it works everywhere, that's fine by me.

Unfortunately, it does not work as intended: the printf solution cannot
print nothing, but that should be the case in all but one of the tests.

-- Hannes


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

2019-02-09 Thread Johannes Sixt
Am 09.02.19 um 05:24 schrieb Jeff King:
> On Fri, Feb 08, 2019 at 05:53:53PM -0500, Randall S. Becker wrote:
> 
>>> 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.
> 
> Great. Since it sounds like you're preparing some patches to deal with
> /dev/zero elsewhere, do you want to wrap it up in a patch as part of
> that?

Please do not use yes to generate an infinite amount of bytes. Our
implementation of yes() in test-lib.sh generates only 99 lines.

Perhaps do this.

- 8< -
Subject: [PATCH] t5318: avoid /dev/zero

Some platforms do not offer /dev/zero. Use printf and tr to generate
a certain amount of NUL bytes.

Reported-by: Randall S. Becker 
Signed-off-by: Johannes Sixt 
---
 t/t5318-commit-graph.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 16d10ebce8..04d394274f 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)) &&
+   printf "%0*d" $(($orig_size - $zero_pos)) 0 | tr 0 '\0' |
+   dd 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
-- 
2.20.1.86.gb0de946387


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

2019-02-08 Thread Johannes Sixt
Am 08.02.19 um 19:03 schrieb Jeff King:
> On Fri, Feb 08, 2019 at 12:49:59PM -0500, Randall S. Becker wrote:
>> Would you object to something like this:
>>
>> if [ ! -e /dev/zero ]; then
>>  # use shred or some other mechanism (still trying to figure out a 
>> solution)
>> else
>>  # existing dd
>> fi
> 
> That's fine, as long as it's wrapped up in a function in order to keep
> the tests readable.
> 
> Though I suspect we may be able to just find a solution that works
> everywhere, without having two different implementations. If we know we
> need $count bytes for dd, we could probably just generate a file with
> that many NULs in it.
> 
> Other cases don't seem to actually care that they're getting NULs, and
> are just redirecting stdin from /dev/zero to get an infinite amount of
> input. They could probably use "yes" for that.

If the data does not have to be a sequence of zero bytes, the
alternatives are:

* `test-genrandom seed-string $size` for a sequence of reproducible
"random" bytes

* `printf "%0*d" $size 0` for a sequence of '0' characters.

In t5318, the zero bytes do matter, though.

-- Hannes


Re: [PATCH] tile: support GENERIC_KERNEL_THREAD and GENERIC_KERNEL_EXECVE

2012-10-24 Thread Johannes Sixt
Am 10/24/2012 0:23, schrieb Jeff King:
> For the fold-on-rebase idea, I'd think you would want something similar,
> like setting rebase.foldNotes to "foo" to say "refs/notes/foo contains
> pseudo-headers that should be folded in like a signed-off-by".

If you are rebasing anyway, you can already use interactive rebase's
--autosquash option:

# a late ACK came in:
git commit --allow-empty -m'squash! tile: support GENERIC_

Acked-by: A U Thor '

git rebase -i --keep-empty --autosquash $forkpoint

Requires git 1.7.11 for --keep-empty and requires to edit out the
'squash!...' headers when the editor appears during the rebase.

-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tile: support GENERIC_KERNEL_THREAD and GENERIC_KERNEL_EXECVE

2012-10-24 Thread Johannes Sixt
Am 10/24/2012 0:23, schrieb Jeff King:
 For the fold-on-rebase idea, I'd think you would want something similar,
 like setting rebase.foldNotes to foo to say refs/notes/foo contains
 pseudo-headers that should be folded in like a signed-off-by.

If you are rebasing anyway, you can already use interactive rebase's
--autosquash option:

# a late ACK came in:
git commit --allow-empty -m'squash! tile: support GENERIC_

Acked-by: A U Thor aut...@example.com'

git rebase -i --keep-empty --autosquash $forkpoint

Requires git 1.7.11 for --keep-empty and requires to edit out the
'squash!...' headers when the editor appears during the rebase.

-- Hannes
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/