Re: [PATCH v2 7/8] packed-backend: check whether the "packed-refs" is sorted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 31, 2025 at 10:35:51PM +0800, shejialuo wrote:
> On Thu, Jan 30, 2025 at 11:02:18AM -0800, Junio C Hamano wrote:
> > shejialuo <shejialuo@xxxxxxxxx> writes:
> > Makes sense. It has been a source of bugs a couple years ago, and it can
> > silently make you receive wrong results, so this is quite a sensible
> > check to have.
> 
> Patrick, could you please help to explain this. I don't know whether we
> need to check whether "packed-refs" is sorted always. It seems that we
> truly allow refs unsorted. We need to know whether we should tighten
> this?

The context here is that packed-refs sometimes claim that they are
sorted, but indeed they aren't. There are two sources for this that I've
seen in the wild:

  - An invalid comparison function. I think I remember that libgit2 at
    one point sorted them incorrectly, but not a 100% sure anymore where
    I've seen this.

  - A user manually edits the packed-refs file, but isn't aware of the
    sorting.

So we should assert that a packed-refs file is correctly sorted, but
only when the header claims that it should be sorted.

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux