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

Re: fatal from submodule status --recursive when used with grep -q

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 19, 2024, 01:16 UTC
Message-ID
<xmqq1q1ga1dp.fsf@gitster.g>
In-Reply-To
<7b4ce2fc-3763-4881-8459-e0c1f2cbc69d@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 12 quoted lines
> On 16/09/2024 16:08, Matt Liberty wrote:
>> If I try to grep the output I get a fatal error:
>> % git submodule status --recursive | grep -q "^+"
>> fatal: failed to recurse into submodule 'tools/OpenROAD'
>> I didn't expect any output but did want the return status (0).  I'm
>> guessing git is unhappy that grep -q exits on the first occurrence of
>> the pattern.  I don't feel fatal is appropriate here.
>
> I assume git is dying with SIGPIPE. As the only purpose of "git
> submodule status" is to write the status information to stdout that
> sounds reasonable. If you want to collect the exit status you need to
> consume the whole output so that the command runs to completion.

Yes, but isn't the main point of that complaint that "failed to recurse into" is not a good way to say "because you closed the reading end of the pipe, we are aborting the operation and not decending into 'tools/OpenROAD' submodule", is it?

Previous: Matt LibertyNext: Matt Liberty
Message 4 of 11 in “fatal from submodule status --recursive when used with grep -q”
  1. Matt LibertySep 16, 2024
  2. Phillip WoodSep 18, 2024
  3. Matt LibertySep 18, 2024
  4. Junio C HamanoSep 19, 2024
  5. Matt LibertySep 19, 2024
  6. phillip.wood123@gmail.comSep 19, 2024
  7. Matt LibertySep 19, 2024
  8. Junio C HamanoSep 19, 2024
  9. Eric SunshineSep 19, 2024
  10. Matt LibertySep 19, 2024
  11. phillip.wood123@gmail.comSep 20, 2024

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.