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

Re: [PATCH] apply: Avoid ambiguous pointer provenance for CHERI/Arm's Morello

From
René Scharfe <l.s.r@web.de>
Date
Jan 8, 2022, 00:04 UTC
Message-ID
<4f05f434-7bd1-d563-94bd-607858deb1f8@web.de>
In-Reply-To
<xmqq35lz9vxl.fsf@gitster.g>
Am 07.01.22 um 20:40 schrieb Junio C Hamano:
Show 26 quoted lines
> René Scharfe <l.s.r@web.de> writes:
>
>>> I actually wonder if it results in code that is much easier to
>>> follow if we did:
>>>
>>>  * Introduce an "enum apply_symlink_treatment" that has
>>>    APPLY_SYMLINK_GOES_AWAY and APPLY_SYMLINK_IN_RESULT as its
>>>    possible values;
>>>
>>>  * Make register_symlink_changes() and check_symlink_changes()
>>>    work with "enum apply_symlink_treatment";
>>>
>>>  * (optional) stop using string_list() to store the symlink_changes;
>>>    use strintmap and use strintmap_set() and strintmap_get() to
>>>    access its entries, so that the ugly implementation detail
>>>    (i.e. "the container type we use only has a (void *) field to
>>>    store caller-supplied data, so we cast an integer and a pointer
>>>    back and forth") can be safely hidden.
>>>
>> Or strsets -- we only need two.
>
> True.
>
> When we check a path, we make a single look-up of two bit in a
> single hashtable but now we need two look-ups, but addition, removal
> and renaming of a symlink would be rare enough to matter either way.

Hmm, symlinks changes are rare, but this only affects the register phase (which should be noticeably slow for the string_list based code with its O(n*log(n)) lookup per registered symlink if there were a lot of them). But the final lookups are done for each path _component_, of any file type.

I suspect that two lookups in (sparsely populated) hash tables are still fast enough. (At least I couldn't measure any difference with git apply and a patch between v2.33.0 and v2.34.0.)

René
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 14 in “apply: Avoid ambiguous pointer provenance for CHERI/Arm's Morello”
  1. apply: Avoid ambiguous pointer provenance for CHERI/Arm's MorelloJessica Clarke, Jan 5, 2022
  2. Konstantin KhomoutovJan 5, 2022
  3. Jessica ClarkeJan 5, 2022
  4. Taylor BlauJan 6, 2022
  5. Jessica ClarkeJan 6, 2022
  6. Junio C HamanoJan 6, 2022
  7. Jessica ClarkeJan 6, 2022
  8. Junio C HamanoJan 6, 2022
  9. René ScharfeJan 7, 2022
  10. Jessica ClarkeJan 7, 2022
  11. Junio C HamanoJan 7, 2022
  12. René ScharfeJan 8, 2022
  13. Junio C HamanoJan 8, 2022
  14. Junio C HamanoJan 7, 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.