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

Re: [PATCH v3] diff-lib: Fix check_removed when fsmonitor is on

From
Josip Sokcevic <sokcevic@google.com>
Date
Sep 14, 2023, 22:39 UTC
Message-ID
<CAJiyOiidpD5eNvxVV8rZP7Xej4_8bBfgTOG75T8PVsmvwya3hg@mail.gmail.com>
In-Reply-To
<xmqqfs3jpbg2.fsf@gitster.g>
On Tue, Sep 12, 2023 at 10:07 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> It seems to be entirely doable, even though the stench from the
> abstraction layer violation may be horrible.
>
> ie_match_stat(), which is called by match_stat_with_submodule(),
> does pay attention to CE_FSMONITOR_VALID bit, so none of the members
> of struct stat matters when the bit is set.  But the bit is not set,
> all members that fill_stat_data() and ce_match_stat_basic() care
> about do matter.  Other code that follows callers of check_removed()
> do care about at least .st_mode member, and I suspect that in the
> current code .st_mode is the only member that gets looked at.
>
> So after all, I think your original "fix" was correct, but it took
> us some time to figure out why it was, which means we would want to
> explain it in the log message for developers who would want to touch
> the same area in the future.

I finished testing this - after my original fix and after running all tests, I can confirm that `st_mode` of `struct stat` is indeed not consumed if CE_FSMONITOR_VALID is set. But, it's fragile and likely to cause problems in the future. Your approach of constructing `struct stat` based on `struct cache_entry` is the way to go.

I see you created a new set of patches in a separate thread, so I'll start those tests and report back there.

Thanks!
-- 
Josip Sokcevic
Previous: Junio C HamanoNext: Junio C Hamano
Message 17 of 18 in “Strange diff-index with fsmonitor, submodules”
  1. Jonathan TanAug 29, 2023
  2. Junio C HamanoAug 29, 2023
  3. Jeff HostetlerAug 29, 2023
  4. Jeff HostetlerAug 29, 2023
  5. Jonathan TanAug 29, 2023
  6. [diff-lib] Fix check_removed when fsmonitor is onJosip Sokcevic, Sep 6, 2023
  7. Jonathan TanSep 6, 2023
  8. diff-lib: Fix check_removed when fsmonitor is onJosip Sokcevic, Sep 7, 2023
  9. Jonathan TanSep 7, 2023
  10. Junio C HamanoSep 7, 2023
  11. Josip SokcevicSep 7, 2023
  12. Junio C HamanoSep 8, 2023
  13. diff-lib: Fix check_removed when fsmonitor is onJosip Sokcevic, Sep 11, 2023
  14. Junio C HamanoSep 11, 2023
  15. Josip SokcevicSep 12, 2023
  16. Junio C HamanoSep 12, 2023
  17. Josip SokcevicSep 14, 2023
  18. Junio C HamanoSep 18, 2023

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.