Subject: Re: [PATCH nd/threaded-index-pack] index-pack: disable threading if NO_PREAD is defined

From: Junio C Hamano <[email-masked]>
Date: Fri, 20 Apr 2012 12:49:42 -0700

Johannes Sixt <[email-masked]> writes:

> Am 4/19/2012 16:05, schrieb Nguyễn Thái Ngọc Duy:
>> NO_PREAD simulates pread() as a sequence of seek, read, seek in
>> compat/pread.c. The simulation is not thread-safe because another
>> thread could move the file offset away in the middle of pread
>> operation. Do not allow threading in that case.
>
> Unsurprisingly, this fixes the breakage for me.
>
> I used the attached patch to keep t9300 running when the breakage
> was detected.
>
> --- 8< ---
> From: Johannes Sixt <[email-masked]>
> Subject: [PATCH] t9300-fast-import: avoid 'exit' in test_expect_success snippets
>
> Exiting from a for-loop early using '|| break' does not propagate the
> failure code, and for this reason, the tests used just 'exit'. But this
> ends the test script with 'FATAL: Unexpected exit code 1' in the case of
> a failed test.
>
> Fix this by moving the loop into a shell function, from which we can
> simply return early.

Makes sense.  If the original were written more readably, I may have
suggested to run the entire for loop in a subshell, but a helper
function is equally readable and with many identical checks, it is the
right way to do this.

Thanks.