From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jessica Clarke <jrtc27@jrtc27.com>, git@vger.kernel.org
Subject: Re: [PATCH] apply: Avoid ambiguous pointer provenance for CHERI/Arm's Morello
Date: Sat, 8 Jan 2022 01:04:23 +0100 [thread overview]
Message-ID: <4f05f434-7bd1-d563-94bd-607858deb1f8@web.de> (raw)
In-Reply-To: <xmqq35lz9vxl.fsf@gitster.g>
Am 07.01.22 um 20:40 schrieb Junio C Hamano:
> 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é
next prev parent reply other threads:[~2022-01-08 0:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-05 13:23 [PATCH] apply: Avoid ambiguous pointer provenance for CHERI/Arm's Morello Jessica Clarke
2022-01-05 16:39 ` Konstantin Khomoutov
2022-01-05 16:40 ` Jessica Clarke
2022-01-06 22:50 ` Taylor Blau
2022-01-06 22:57 ` Jessica Clarke
2022-01-06 22:53 ` Junio C Hamano
2022-01-06 23:02 ` Jessica Clarke
2022-01-06 23:41 ` Junio C Hamano
2022-01-07 12:16 ` René Scharfe
2022-01-07 13:00 ` Jessica Clarke
2022-01-07 19:40 ` Junio C Hamano
2022-01-08 0:04 ` René Scharfe [this message]
2022-01-08 0:51 ` Junio C Hamano
2022-01-07 23:25 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4f05f434-7bd1-d563-94bd-607858deb1f8@web.de \
--to=l.s.r@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrtc27@jrtc27.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).