Re: segmentation fault (nullpointer) with git log --submodule -p
- From
Stefan Näwe <stefan.naewe@atlas-elektronik.com>
- Date
- Jan 24, 2013, 14:06 UTC
- Message-ID
- <51013FDD.5030004@atlas-elektronik.com>
- In-Reply-To
- <CACsJy8B9O=A26_=sv1JEYdtazsWa4khZkqpTgFSSTs_RGGPZqQ@mail.gmail.com>
Am Donnerstag, 24. Januar 2013 14:40:47 schrieb Duy Nguyen:
Show 30 quoted lines
> On Thu, Jan 24, 2013 at 7:11 PM, Stefan Näwe > <stefan.naewe@atlas-elektronik.com> wrote: >>> Does it fail with older versions of git? If so, can you bisect? >> >> I did. My bisection told me this is the suspect: >> >> ccdc603 (parse_object: try internal cache before reading object db) > > diff --git a/object.c b/object.c > index d8d09f9..6b06297 100644 > --- a/object.c > +++ b/object.c > @@ -191,10 +191,15 @@ struct object *parse_object(const unsigned char *sha1) > enum object_type type; > int eaten; > const unsigned char *repl = lookup_replace_object(sha1); > - void *buffer = read_sha1_file(sha1, &type, &size); > + void *buffer; > + struct object *obj; > + > + obj = lookup_object(sha1); > + if (obj && obj->parsed) > + return obj; > > Any chance obj->parsed is 1 but ((struct commit*)obj)->buffer is NULL? > What if you change that "if" to > > if (obj && obj->parsed && (obj->type != OBJ_COMMIT || ((struct commit > *)obj)->buffer)) >
No more segfault!
> Also you did not encode commits in any specific encoding,
We're using Git for Windows and some commits contain 'umlauts' (äöü). But those characters should be encoded in UTF-8, shouldn't they? But the 'git log...' only crashes on a Debian/Linux machine.
> nor set i18n.logOutputEncoding?
It's not set.
(only i18n.filesEncoding is set to utf-8 on my machine)
Oh, and it's not crashing if I do:
git log -p --submodule |cat
Stefan -- ---------------------------------------------------------------- /dev/random says: Dumb luck beats sound planning every time. Trust me. python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')"