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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 20, 2012, 19:49 UTC
Message-ID
<xmqqr4vimbe1.fsf@junio.mtv.corp.google.com>
In-Reply-To
<4F910145.5030102@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 22 quoted lines
> 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 <j6t@kdbg.org>
> 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.
Previous: Johannes Sixt
Message 4 of 4 in “index-pack: disable threading if NO_PREAD is defined”
  1. index-pack: disable threading if NO_PREAD is definedNguyễn Thái Ngọc Duy, Apr 19, 2012
  2. Junio C HamanoApr 19, 2012
  3. Johannes SixtApr 20, 2012
  4. Junio C HamanoApr 20, 2012

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.