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

Re: fsck: BAD_FILEMODE diagnostic broken / never triggers

From
Jeff King <peff@peff.net>
Date
Aug 9, 2022, 22:48 UTC
Message-ID
<YvLkU3X9lBsG8wXp@coredump.intra.peff.net>
In-Reply-To
<B3488A12-BCE3-48C8-915C-E2AC4E71ECD2@masklinn.net>
On Sat, Aug 06, 2022 at 03:43:56PM +0200, Xavier Morel wrote:
Show 9 quoted lines
> However looking at fsck_tree, it does have a fair amount of code to
> validate entry modes and a dedicated message id for this (BAD_FILEMODE
> / badFilemode), it even has a code path for legacy entries with
> S_IWGRP set (extensively documented under `git fsck --strict`).
> 
> I guess, over time mode canonicalisation has slowly creeped earlier
> the tree-parsing code, and (seemingly for several years) it has been
> occurring before "git fsck" gets tree entry information, so git fsck
> simply can not see invalid entry modes?

Yes, I think you're right. I didn't bisect, but I suspect this goes back to 7146e66f08 (tree-walk: finally switch over tree descriptors to contain a pre-parsed entry, 2014-02-06).

We probably need to provide version of decode_tree_entry() which gives the non-canonical mode, and to call it from fsck.

-Peff
Previous: Xavier MorelNext: Jeff King
Message 2 of 17 in “fsck: BAD_FILEMODE diagnostic broken / never triggers”
  1. Xavier MorelAug 6, 2022
  2. Jeff KingAug 9, 2022
  3. Jeff KingAug 9, 2022
  4. Xavier MorelAug 10, 2022
  5. Jeff KingAug 10, 2022
  6. 0/3 actually detect bad file modes in fsckJeff King, Aug 10, 2022
  7. 1/3 tree-walk: add a mechanism for getting non-canonicalized modesJeff King, Aug 10, 2022
  8. 2/3 fsck: actually detect bad file modes in treesJeff King, Aug 10, 2022
  9. Junio C HamanoAug 10, 2022
  10. Jeff KingAug 10, 2022
  11. Junio C HamanoAug 10, 2022
  12. 3/3 fsck: downgrade tree badFilemode to "info"Jeff King, Aug 10, 2022
  13. Junio C HamanoAug 10, 2022
  14. Jeff KingAug 11, 2022
  15. Junio C HamanoAug 11, 2022
  16. Ævar Arnfjörð BjarmasonAug 11, 2022
  17. Jeff KingAug 14, 2022

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.