git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keshav Kini <keshav.kini@gmail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH] drop support for "experimental" loose objects
Date: Thu, 21 Nov 2013 08:42:09 -0600	[thread overview]
Message-ID: <87ppptolz2.fsf@gmail.com> (raw)
In-Reply-To: CACsJy8B5xY1FZyhPdct8Nt6Gad2cveRvmOXTXJP=uCaG2_0KuA@mail.gmail.com

Duy Nguyen <pclouds@gmail.com> writes:

> On Thu, Nov 21, 2013 at 6:48 PM, Jeff King <peff@peff.net> wrote:
>> @@ -1514,14 +1469,6 @@ unsigned long unpack_object_header_buffer(const unsigned char *buf,
>>
>>  int unpack_sha1_header(git_zstream *stream, unsigned char *map, unsigned long mapsize, void *buffer, unsigned long bufsiz)
>>  {
>> -       unsigned long size, used;
>> -       static const char valid_loose_object_type[8] = {
>> -               0, /* OBJ_EXT */
>> -               1, 1, 1, 1, /* "commit", "tree", "blob", "tag" */
>> -               0, /* "delta" and others are invalid in a loose object */
>> -       };
>> -       enum object_type type;
>> -
>>         /* Get the data stream */
>>         memset(stream, 0, sizeof(*stream));
>>         stream->next_in = map;
>> @@ -1529,27 +1476,6 @@ int unpack_sha1_header(git_zstream *stream, unsigned char *map, unsigned long ma
>>         stream->next_out = buffer;
>>         stream->avail_out = bufsiz;
>>
>> -       if (experimental_loose_object(map)) {
>
> Perhaps keep this..
>
>> -               /*
>> -                * The old experimental format we no longer produce;
>> -                * we can still read it.
>> -                */
>> -               used = unpack_object_header_buffer(map, mapsize, &type, &size);
>> -               if (!used || !valid_loose_object_type[type])
>> -                       return -1;
>> -               map += used;
>> -               mapsize -= used;
>> -
>> -               /* Set up the stream for the rest.. */
>> -               stream->next_in = map;
>> -               stream->avail_in = mapsize;
>> -               git_inflate_init(stream);
>> -
>> -               /* And generate the fake traditional header */
>> -               stream->total_out = 1 + snprintf(buffer, bufsiz, "%s %lu",
>> -                                                typename(type), size);
>> -               return 0;
>
> and replace all this with
>
> die("detected an object in obsolete format, please repack the
> repository using a version before XXX");
>
> ?

Wouldn't that fail to solve the issue of `git fsck` dying on corrupt
data?  experimental_loose_object() would need to be rewritten to be more
conservative in deciding that an object was in the experimental loose
object format.

-Keshav

  reply	other threads:[~2013-11-21 14:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 20:33 corrupt object memory allocation error Joey Hess
2013-11-20 21:33 ` Jeff King
2013-11-20 22:28   ` Joey Hess
2013-11-21 11:41     ` [PATCH] drop support for "experimental" loose objects Jeff King
2013-11-21 11:48       ` Jeff King
2013-11-21 12:43         ` Duy Nguyen
2013-11-21 14:42           ` Keshav Kini [this message]
2013-11-21 22:41           ` Jeff King
2013-11-21 19:44         ` Junio C Hamano
2013-11-23  0:24         ` Jonathan Nieder
2013-11-23  0:30           ` Jeff King
2013-11-23  0:47             ` Jonathan Nieder
2013-11-21 16:04       ` Joey Hess
2013-11-21 20:19         ` Christian Couder
2013-11-22  9:58           ` Jeff King
2013-11-22 11:04             ` Christian Couder
2013-11-22 11:24               ` Jeff King
2013-11-22 14:23                 ` Christian Couder
2013-11-22 16:15                   ` Jeff King
2013-11-22 17:23             ` Junio C Hamano
2013-11-22  2:09         ` Jeff King
2013-11-22 17:28           ` Joey Hess
2013-11-24  8:44             ` Jeff King
2013-11-24  9:07               ` Jeff King
2013-11-25 18:35                 ` Junio C Hamano
2013-11-27  9:30                   ` Jeff King
2013-11-27 18:57                     ` Junio C Hamano
2013-11-27 19:03                       ` Jeff King

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ppptolz2.fsf@gmail.com \
    --to=keshav.kini@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).