{"thread":{"id":"50648","subject":"Can't build first git commit","startedAt":"2019-03-04T19:58:41Z","lastAt":"2019-03-07T20:07:23Z","messageCount":18,"participants":["Fabio Aiuto","Santiago Torres","Jeff King","asymptosis","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"370630","messageId":"1551729517.4092.1.camel@libero.it","threadId":"50648","inReplyTo":null,"subject":"Can't build first git commit","fromName":"Fabio Aiuto","fromEmail":"polinice83@libero.it","sentAt":"2019-03-04T19:58:37Z","receivedAt":"2019-03-04T19:58:41Z","isPatch":false,"sender":{"key":"polinice83@libero.it","avatar":null},"body":"Hi to all,\n\nI'm trying to build first commit of git made by Linus. I mean the one\nnamed e83c5163316f89bfbde7d9ab23... (I think this is enough).\nBut at building stage i have the following error:\n\nmake all \ngcc -g -o update-cache update-cache.o read-cache.o -lssl\n/usr/bin/ld: update-cache.o: undefined reference to symbol\n'SHA1_Update@@OPENSSL_1_1_0'\n//usr/lib/i386-linux-gnu/libcrypto.so.1.1: error adding symbols: DSO\nmissing from command line\ncollect2: error: ld returned 1 exit status\nmake: *** [update-cache] Errore 1\nMakefile:16: set di istruzioni per l'obiettivo \"update-cache\" non\nriuscito\n\nI run a debian stretch on my machine. Could anyone help me?\nThanks in advance.\nFabio.\n\n"},{"id":"370631","messageId":"20190304201011.j7dopqp6ug66ccum@LykOS.localdomain","threadId":"50648","inReplyTo":"1551729517.4092.1.camel@libero.it","subject":"Re: Can't build first git commit","fromName":"Santiago Torres","fromEmail":"santiago@nyu.edu","sentAt":"2019-03-04T20:10:12Z","receivedAt":"2019-03-04T20:11:33Z","isPatch":false,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"This commit is about 14 years old:\n\n    Date:   Thu Apr 7 15:13:13 2005 -0700\n\nUnless you have a toolchain from around that time, I'd be very surprised\nif things build. Notably, there you're having an issue with the symbols\nthat lssl is exposing (I suspect you're not even using the openssl 1.0.0\nseries anymore.\n\nThanks,\n-Santiago.\n\nOn Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote:\n> Hi to all,\n> \n> I'm trying to build first commit of git made by Linus. I mean the one\n> named e83c5163316f89bfbde7d9ab23... (I think this is enough).\n> But at building stage i have the following error:\n> \n> make all \n> gcc -g -o update-cache update-cache.o read-cache.o -lssl\n> /usr/bin/ld: update-cache.o: undefined reference to symbol\n> 'SHA1_Update@@OPENSSL_1_1_0'\n> //usr/lib/i386-linux-gnu/libcrypto.so.1.1: error adding symbols: DSO\n> missing from command line\n> collect2: error: ld returned 1 exit status\n> make: *** [update-cache] Errore 1\n> Makefile:16: set di istruzioni per l'obiettivo \"update-cache\" non\n> riuscito\n> \n> I run a debian stretch on my machine. Could anyone help me?\n> Thanks in advance.\n> Fabio.\n> \n"},{"id":"370633","messageId":"1551730792.4573.1.camel@libero.it","threadId":"50648","inReplyTo":"20190304201011.j7dopqp6ug66ccum@LykOS.localdomain","subject":"Re: Can't build first git commit","fromName":"Fabio Aiuto","fromEmail":"polinice83@libero.it","sentAt":"2019-03-04T20:19:52Z","receivedAt":"2019-03-04T20:19:58Z","isPatch":false,"sender":{"key":"polinice83@libero.it","avatar":null},"body":"What a pity, It would have been very useful for me, to debug around\nthat simple version, to understand how everithing works.\nThank you Santiago.\nFabio.\nIl giorno lun, 04/03/2019 alle 15.10 -0500, Santiago Torres ha scritto:\n> This commit is about 14 years old:\n> \n>     Date:   Thu Apr 7 15:13:13 2005 -0700\n> \n> Unless you have a toolchain from around that time, I'd be very\n> surprised\n> if things build. Notably, there you're having an issue with the\n> symbols\n> that lssl is exposing (I suspect you're not even using the openssl\n> 1.0.0\n> series anymore.\n> \n> Thanks,\n> -Santiago.\n> \n> On Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote:\n> > Hi to all,\n> > \n> > I'm trying to build first commit of git made by Linus. I mean the\n> > one\n> > named e83c5163316f89bfbde7d9ab23... (I think this is enough).\n> > But at building stage i have the following error:\n> > \n> > make all \n> > gcc -g -o update-cache update-cache.o read-cache.o -lssl\n> > /usr/bin/ld: update-cache.o: undefined reference to symbol\n> > 'SHA1_Update@@OPENSSL_1_1_0'\n> > //usr/lib/i386-linux-gnu/libcrypto.so.1.1: error adding symbols:\n> > DSO\n> > missing from command line\n> > collect2: error: ld returned 1 exit status\n> > make: *** [update-cache] Errore 1\n> > Makefile:16: set di istruzioni per l'obiettivo \"update-cache\" non\n> > riuscito\n> > \n> > I run a debian stretch on my machine. Could anyone help me?\n> > Thanks in advance.\n> > Fabio.\n> > \n"},{"id":"370634","messageId":"20190304202258.ywnnzd4zaay5q7z4@LykOS.localdomain","threadId":"50648","inReplyTo":"1551730792.4573.1.camel@libero.it","subject":"Re: Can't build first git commit","fromName":"Santiago Torres","fromEmail":"santiago@nyu.edu","sentAt":"2019-03-04T20:22:59Z","receivedAt":"2019-03-04T20:23:07Z","isPatch":false,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"It happens. \n\nSomething that I liked playing with to get myself a better handle of how\ngit works is using libgit2 and its python bindings. I find the codebase\na little bit smaller and its bindings to higher-level languages can help\nyou abstract the memory management and other low-level stuff that is\nsometimes distracting.\n\nGood luck!\n-Santiago.\n\n\nOn Mon, Mar 04, 2019 at 09:19:52PM +0100, Fabio Aiuto wrote:\n> What a pity, It would have been very useful for me, to debug around\n> that simple version, to understand how everithing works.\n> Thank you Santiago.\n> Fabio.\n> Il giorno lun, 04/03/2019 alle 15.10 -0500, Santiago Torres ha scritto:\n> > This commit is about 14 years old:\n> > \n> >     Date:   Thu Apr 7 15:13:13 2005 -0700\n> > \n> > Unless you have a toolchain from around that time, I'd be very\n> > surprised\n> > if things build. Notably, there you're having an issue with the\n> > symbols\n> > that lssl is exposing (I suspect you're not even using the openssl\n> > 1.0.0\n> > series anymore.\n> > \n> > Thanks,\n> > -Santiago.\n> > \n> > On Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote:\n> > > Hi to all,\n> > > \n> > > I'm trying to build first commit of git made by Linus. I mean the\n> > > one\n> > > named e83c5163316f89bfbde7d9ab23... (I think this is enough).\n> > > But at building stage i have the following error:\n> > > \n> > > make all \n> > > gcc -g -o update-cache update-cache.o read-cache.o -lssl\n> > > /usr/bin/ld: update-cache.o: undefined reference to symbol\n> > > 'SHA1_Update@@OPENSSL_1_1_0'\n> > > //usr/lib/i386-linux-gnu/libcrypto.so.1.1: error adding symbols:\n> > > DSO\n> > > missing from command line\n> > > collect2: error: ld returned 1 exit status\n> > > make: *** [update-cache] Errore 1\n> > > Makefile:16: set di istruzioni per l'obiettivo \"update-cache\" non\n> > > riuscito\n> > > \n> > > I run a debian stretch on my machine. Could anyone help me?\n> > > Thanks in advance.\n> > > Fabio.\n> > > \n"},{"id":"370637","messageId":"20190304204007.GA32691@sigill.intra.peff.net","threadId":"50648","inReplyTo":"1551729517.4092.1.camel@libero.it","subject":"Re: Can't build first git commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-03-04T20:40:08Z","receivedAt":"2019-03-04T20:40:11Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote:\n\n> I'm trying to build first commit of git made by Linus. I mean the one\n> named e83c5163316f89bfbde7d9ab23... (I think this is enough).\n> But at building stage i have the following error:\n> \n> make all \n> gcc -g -o update-cache update-cache.o read-cache.o -lssl\n> /usr/bin/ld: update-cache.o: undefined reference to symbol\n> 'SHA1_Update@@OPENSSL_1_1_0'\n\nThe sha1 routines are in libcrypto. See 3be4b61aa4 (Link with -lcrypto\ninstead of -lssl when using openssl libraries., 2005-05-10). I also\nneeded -lz. See 9426167765 (Add \"-lz\" to link line to get in zlib.,\n2005-04-08).\n\nYou can patch the Makefile, or just override it like:\n\n  make LIBS='-lcrypto -lz'\n\nwhich builds for me on current Debian unstable. I don't think you can\nactually fetch with that old build, but I used periodically check that\nGit v1.0 can fetch happily from GitHub. I haven't in a while, so let me\nknow if you try it and it doesn't work. ;)\n\n-Peff\n"},{"id":"370644","messageId":"20190304214829.GA573@sleipnir","threadId":"50648","inReplyTo":"1551730792.4573.1.camel@libero.it","subject":"Re: Can't build first git commit","fromName":"asymptosis","fromEmail":"asymptosis@posteo.net","sentAt":"2019-03-04T21:48:30Z","receivedAt":"2019-03-04T21:48:40Z","isPatch":false,"sender":{"key":"asymptosis@posteo.net","avatar":null},"body":"On Mon, Mar 04, 2019 at 09:19:52PM +0100, Fabio Aiuto wrote:\n> What a pity, It would have been very useful for me, to debug around\n> that simple version, to understand how everithing works.\n\nTo understand how Git works, it is a good idea to work through the \"Git\nInternals\" chapter in the Git Book:\n\nhttps://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain\n\nTo help me understand that chapter, I started re-implementing Git as simple\nbash scripts, which have been placed at https://notabug.org/cryptarch/sgit\n"},{"id":"370645","messageId":"20190304222559.GA112305@google.com","threadId":"50648","inReplyTo":"1551730792.4573.1.camel@libero.it","subject":"Re: Can't build first git commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2019-03-04T22:25:59Z","receivedAt":"2019-03-04T22:26:04Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nFabio Aiuto wrote:\n\n> What a pity, It would have been very useful for me, to debug around\n> that simple version, to understand how everithing works.\n\nJeff King suggested how you can update the build command to get it\nworking.  In general, I think people sometimes overthink what is\ninvolved in a build: something like\n\n\tcc *.c\n\nplus appropriate warning, optimization, debug, -D, and library flags\nshould work just fine.\n\nIf you haven't already read it, I also recommend reading\nhttps://www.kernel.org/pub/software/scm/git/docs/user-manual.html#hacking-git.\nIf you have ideas for improving the text there (perhaps with suggested\nbuild instructions?), patches to Documentation/user-manual.txt are\nvery welcome.\n\nThanks and happy hacking,\nJonathan\n"},{"id":"370726","messageId":"1551811374.1607.3.camel@libero.it","threadId":"50648","inReplyTo":"20190304204007.GA32691@sigill.intra.peff.net","subject":"Re: Can't build first git commit","fromName":"Fabio Aiuto","fromEmail":"polinice83@libero.it","sentAt":"2019-03-05T18:42:54Z","receivedAt":"2019-03-05T18:42:59Z","isPatch":false,"sender":{"key":"polinice83@libero.it","avatar":null},"body":"\nThank you Jeff I'll have news within few days!!!\nIl giorno lun, 04/03/2019 alle 15.40 -0500, Jeff King ha scritto:\n> On Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote:\n> \n> > I'm trying to build first commit of git made by Linus. I mean the\n> > one\n> > named e83c5163316f89bfbde7d9ab23... (I think this is enough).\n> > But at building stage i have the following error:\n> > \n> > make all \n> > gcc -g -o update-cache update-cache.o read-cache.o -lssl\n> > /usr/bin/ld: update-cache.o: undefined reference to symbol\n> > 'SHA1_Update@@OPENSSL_1_1_0'\n> \n> The sha1 routines are in libcrypto. See 3be4b61aa4 (Link with\n> -lcrypto\n> instead of -lssl when using openssl libraries., 2005-05-10). I also\n> needed -lz. See 9426167765 (Add \"-lz\" to link line to get in zlib.,\n> 2005-04-08).\n> \n> You can patch the Makefile, or just override it like:\n> \n>   make LIBS='-lcrypto -lz'\n> \n> which builds for me on current Debian unstable. I don't think you can\n> actually fetch with that old build, but I used periodically check\n> that\n> Git v1.0 can fetch happily from GitHub. I haven't in a while, so let\n> me\n> know if you try it and it doesn't work. ;)\n> \n> -Peff\n"},{"id":"370728","messageId":"20190305191519.GA12791@sigill.intra.peff.net","threadId":"50648","inReplyTo":"20190304204007.GA32691@sigill.intra.peff.net","subject":"Re: Can't build first git commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-03-05T19:15:19Z","receivedAt":"2019-03-05T19:15:23Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Mar 04, 2019 at 03:40:07PM -0500, Jeff King wrote:\n\n> You can patch the Makefile, or just override it like:\n> \n>   make LIBS='-lcrypto -lz'\n> \n> which builds for me on current Debian unstable. I don't think you can\n> actually fetch with that old build, but I used periodically check that\n> Git v1.0 can fetch happily from GitHub. I haven't in a while, so let me\n> know if you try it and it doesn't work. ;)\n\nI just tried this, and it does indeed work. I had to build v1.0.0 with\n\n  make NO_OPENSSL=Nope\n\nI think the issue is that some old code embedded openssl's BIGNUM in a\nstruct, and later versions of openssl stopped publicly defining the\ntypes.\n\nI was able to clone git://github.com/git/git with the result, though of\ncourse it chokes no the sha1collisiondetection submodule. You can still\nuse \"git log\", though, and checkout older commits.\n\n-Peff\n"},{"id":"370823","messageId":"1551902320.1727.1.camel@libero.it","threadId":"50648","inReplyTo":"20190305191519.GA12791@sigill.intra.peff.net","subject":"Re: Can't build first git commit","fromName":"Fabio Aiuto","fromEmail":"polinice83@libero.it","sentAt":"2019-03-06T19:58:40Z","receivedAt":"2019-03-06T19:58:45Z","isPatch":false,"sender":{"key":"polinice83@libero.it","avatar":null},"body":"Il giorno mar, 05/03/2019 alle 14.15 -0500, Jeff King ha scritto:\n> On Mon, Mar 04, 2019 at 03:40:07PM -0500, Jeff King wrote:\n> \n> > You can patch the Makefile, or just override it like:\n> > \n> >   make LIBS='-lcrypto -lz'\n> > \n> > which builds for me on current Debian unstable. I don't think you\n> > can\n> > actually fetch with that old build, but I used periodically check\n> > that\n> > Git v1.0 can fetch happily from GitHub. I haven't in a while, so\n> > let me\n> > know if you try it and it doesn't work. ;)\n> \n> I just tried this, and it does indeed work. I had to build v1.0.0\n> with\n> \n>   make NO_OPENSSL=Nope\n> \n> I think the issue is that some old code embedded openssl's BIGNUM in\n> a\n> struct, and later versions of openssl stopped publicly defining the\n> types.\n> \n> I was able to clone git://github.com/git/git with the result, though\n> of\n> course it chokes no the sha1collisiondetection submodule. You can\n> still\n> use \"git log\", though, and checkout older commits.\n> \n> -Peff\n\nHi Jeff,\nI've just typed make make LIBS='-lcrypto -lz' from the shell inside the\n \ndirectory containing the whole first commit and it seems to work. I\ntrace all through the code. Yes the fetch command wasn't written at\nthat time, right? I didn't understand why should be better to work with\nthe git code from github. There's something I misunderstood?\nThank you Jeff ;-)\n"},{"id":"370825","messageId":"20190306200356.GB23315@sigill.intra.peff.net","threadId":"50648","inReplyTo":"1551902320.1727.1.camel@libero.it","subject":"Re: Can't build first git commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-03-06T20:03:56Z","receivedAt":"2019-03-06T20:04:00Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 06, 2019 at 08:58:40PM +0100, Fabio Aiuto wrote:\n\n> Yes the fetch command wasn't written at that time, right? I didn't\n> understand why should be better to work with the git code from github.\n> There's something I misunderstood?\n\nI just mean that it is an interesting fact that modern Git and Git v1.0\ncan still interact seamlessly over the network. I.e., you could still\ncollaborate with somebody using an ancient version of Git (hopefully\nnobody is using v1.0, but logically it extends to all of the\nintermediate versions).\n\n-Peff\n"},{"id":"370826","messageId":"1551903598.1727.3.camel@libero.it","threadId":"50648","inReplyTo":"20190306200356.GB23315@sigill.intra.peff.net","subject":"Re: Can't build first git commit","fromName":"Fabio Aiuto","fromEmail":"polinice83@libero.it","sentAt":"2019-03-06T20:19:58Z","receivedAt":"2019-03-06T20:20:03Z","isPatch":false,"sender":{"key":"polinice83@libero.it","avatar":null},"body":"Yes that's great.\nWhy somebody told me about a outdate toolchain when I started this\nlittle thread about first git compiling? Sorry for my stupid question\nbut the you just resolved with that make override...\nMaybe there's something I have to know?\n\nIl giorno mer, 06/03/2019 alle 15.03 -0500, Jeff King ha scritto:\n> On Wed, Mar 06, 2019 at 08:58:40PM +0100, Fabio Aiuto wrote:\n> \n> > Yes the fetch command wasn't written at that time, right? I didn't\n> > understand why should be better to work with the git code from\n> > github.\n> > There's something I misunderstood?\n> \n> I just mean that it is an interesting fact that modern Git and Git\n> v1.0\n> can still interact seamlessly over the network. I.e., you could still\n> collaborate with somebody using an ancient version of Git (hopefully\n> nobody is using v1.0, but logically it extends to all of the\n> intermediate versions).\n> \n> -Peff\n"},{"id":"370828","messageId":"1551905579.1727.8.camel@libero.it","threadId":"50648","inReplyTo":"20190306200356.GB23315@sigill.intra.peff.net","subject":"Re: Can't build first git commit","fromName":"Fabio Aiuto","fromEmail":"polinice83@libero.it","sentAt":"2019-03-06T20:52:59Z","receivedAt":"2019-03-06T20:53:03Z","isPatch":false,"sender":{"key":"polinice83@libero.it","avatar":null},"body":"Found this error\n\nProgram received signal SIGSEGV, Segmentation fault.\n0x00401628 in verify_hdr (hdr=0x0, size=32) at read-cache.c:192\n192\t\tif (hdr->signature != CACHE_SIGNATURE)\n\nwhen tracing on line\n\nstatic int verify_hdr(struct cache_header *hdr, unsigned long size)\n{\n\tSHA_CTX c;\n\tunsigned char sha1[20];\n\n\tif (hdr->signature != CACHE_SIGNATURE)<--- this line\n\ninside file read-cache.c\nWhat's going on?\n\nIl giorno mer, 06/03/2019 alle 15.03 -0500, Jeff King ha scritto:\n> On Wed, Mar 06, 2019 at 08:58:40PM +0100, Fabio Aiuto wrote:\n> \n> > Yes the fetch command wasn't written at that time, right? I didn't\n> > understand why should be better to work with the git code from\n> > github.\n> > There's something I misunderstood?\n> \n> I just mean that it is an interesting fact that modern Git and Git\n> v1.0\n> can still interact seamlessly over the network. I.e., you could still\n> collaborate with somebody using an ancient version of Git (hopefully\n> nobody is using v1.0, but logically it extends to all of the\n> intermediate versions).\n> \n> -Peff\n"},{"id":"370829","messageId":"20190306203910.xr2bwpqb3zrxnm63@LykOS.localdomain","threadId":"50648","inReplyTo":"1551903598.1727.3.camel@libero.it","subject":"Re: Can't build first git commit","fromName":"Santiago Torres","fromEmail":"santiago@nyu.edu","sentAt":"2019-03-06T20:39:11Z","receivedAt":"2019-03-06T21:44:31Z","isPatch":false,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"That was proably my bad. \n\nI still find it somewhat astounding that it compiles with a modern\ntoolchain after 15+ years. Many projects fail to do so (it's an\nunderstandably high bar to have).\n\nI'm glad this is possible and you were able to do so (maybe you want to\nshare your experiences about it somewhere? :))\n\nCheers!\n-Santiago.\n\n\nOn Wed, Mar 06, 2019 at 09:19:58PM +0100, Fabio Aiuto wrote:\n> Yes that's great.\n> Why somebody told me about a outdate toolchain when I started this\n> little thread about first git compiling? Sorry for my stupid question\n> but the you just resolved with that make override...\n> Maybe there's something I have to know?\n> \n> Il giorno mer, 06/03/2019 alle 15.03 -0500, Jeff King ha scritto:\n> > On Wed, Mar 06, 2019 at 08:58:40PM +0100, Fabio Aiuto wrote:\n> > \n> > > Yes the fetch command wasn't written at that time, right? I didn't\n> > > understand why should be better to work with the git code from\n> > > github.\n> > > There's something I misunderstood?\n> > \n> > I just mean that it is an interesting fact that modern Git and Git\n> > v1.0\n> > can still interact seamlessly over the network. I.e., you could still\n> > collaborate with somebody using an ancient version of Git (hopefully\n> > nobody is using v1.0, but logically it extends to all of the\n> > intermediate versions).\n> > \n> > -Peff\n"},{"id":"370831","messageId":"20190306215419.GB32630@sigill.intra.peff.net","threadId":"50648","inReplyTo":"20190306203910.xr2bwpqb3zrxnm63@LykOS.localdomain","subject":"Re: Can't build first git commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-03-06T21:54:19Z","receivedAt":"2019-03-06T21:54:23Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 06, 2019 at 03:39:11PM -0500, Santiago Torres wrote:\n\n> I still find it somewhat astounding that it compiles with a modern\n> toolchain after 15+ years. Many projects fail to do so (it's an\n> understandably high bar to have).\n\nI think the key thing is that Git has very few external dependencies.\nYou'll note that I had to turn off OpenSSL support to get it to compile.\nThe only other library from back then is libz, which is extremely\nstable.\n\nOther than, it just depends on a reasonable C compiler and a POSIX libc,\nboth of which have been standardized for decades.\n\nI suspect that today's Git will also compile pretty well in 15 years,\nbut you'll probably to say NO_GETTEXT and turn a few other knobs.\nLibcurl might eventually be a problem, though I've been pretty impressed\nwith its stability and backwards-compatibility so far (and of course\nit's optional if disabling http support is OK).\n\n-Peff\n"},{"id":"370832","messageId":"20190306215752.GC32630@sigill.intra.peff.net","threadId":"50648","inReplyTo":"1551905579.1727.8.camel@libero.it","subject":"Re: Can't build first git commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-03-06T21:57:52Z","receivedAt":"2019-03-06T21:57:56Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 06, 2019 at 09:52:59PM +0100, Fabio Aiuto wrote:\n\n> Found this error\n> \n> Program received signal SIGSEGV, Segmentation fault.\n> 0x00401628 in verify_hdr (hdr=0x0, size=32) at read-cache.c:192\n> 192\t\tif (hdr->signature != CACHE_SIGNATURE)\n> \n> when tracing on line\n> \n> static int verify_hdr(struct cache_header *hdr, unsigned long size)\n> {\n> \tSHA_CTX c;\n> \tunsigned char sha1[20];\n> \n> \tif (hdr->signature != CACHE_SIGNATURE)<--- this line\n> \n> inside file read-cache.c\n> What's going on?\n\nWell, hdr is NULL, so you can't dereference it. Without knowing more\nabout how you called it, it's hard to say. But do note that the index\nformat has been updated once or twice (as well as the pack format). You\nprobably can't just chdir into a clone made by a recent Git and expect\nancient versions to read it.\n\nYou'll have to start a repo from scratch, or clone an existing with the\nold version (which will be tricky; you might have to use a modern\nupload-pack to represent the server side, but I think that first version\ndoesn't even have any fetch capabilities at all).\n\nIt might also be possible to convince modern Git to write out in old\nformats that ancient Git will understand, but I don't know the right\nconfig knobs to tweak offhand.\n\n-Peff\n"},{"id":"370922","messageId":"20190307194146.GA2453@sigill.intra.peff.net","threadId":"50648","inReplyTo":"1551985495.1606.1.camel@libero.it","subject":"Re: Can't build first git commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-03-07T19:41:47Z","receivedAt":"2019-03-07T19:41:50Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"[+cc git@vger; let's keep this on the list; I'm not sure there's a lot\n to be learned from fiddling with this old version, but if we're going\n to do it, let's at least record our attempts for posterity]\n\nOn Thu, Mar 07, 2019 at 08:04:55PM +0100, Fabio Aiuto wrote:\n\n> I made a directory \"trial\" and inside it I ran init-db (that's the\n> grand-father of git init) inside that directory. Then I created a file \n> this way:\n> \n> echo 'helloooo!' >file.txt\n> \n> then then executed update-cache file.txt (thinking that's the ancestor\n> of git add), but that doesn't work and it returns with a segmentation\n> fault, due to the nullity of the header. But in this first commit how\n> do I add a file in the cache? What's the right way to build up a\n> repository from scratch with commit e83c5163316f?\n\nHmm. I tried that, too, and got a segfault. Then I tried it again a few\nminutes later, and it worked.\n\nOne thing that seems to provoke it consistently is having a zero-length\nindex file (because that causes mmap to return NULL, and the code does\nnot check for that case). Try this:\n\n  # This works.\n  init-db\n  echo content >file\n  update-cache file\n\n  # This segfaults\n  >.dircache/index\n  update-cache file\n\n  # And this works again\n  rm .dircache/index\n  update-cache file\n\nI'm not sure why it would ever fail without that explicit empty-file\nwrite. Perhaps there's some code path that writes out an empty index\nfile, and we inadvertently triggered it.\n\nIf you're going to play with such an antique commit, you have to expect\nthat things won't necessarily work, and be ready to poke around in the\ndebugger.\n\n-Peff\n"},{"id":"370925","messageId":"1551989235.1606.3.camel@libero.it","threadId":"50648","inReplyTo":"20190307194146.GA2453@sigill.intra.peff.net","subject":"Re: Can't build first git commit","fromName":"Fabio Aiuto","fromEmail":"polinice83@libero.it","sentAt":"2019-03-07T20:07:15Z","receivedAt":"2019-03-07T20:07:23Z","isPatch":false,"sender":{"key":"polinice83@libero.it","avatar":null},"body":"Sorry for forgetting the cc!!!\nThank you so much for help, hope not to bore you all ;)\nI think that I will go on studying git this way, and follow all the \nimprovements that were made along his history. I think that\nasymptosis too gave me a good link, related to that bash script\nimplmentation.\nThank you Jeff, now I'm trying to understand how could I show the\ncontents of the index in that version.\n\nFabio.\n\nIl giorno gio, 07/03/2019 alle 14.41 -0500, Jeff King ha scritto:\n> [+cc git@vger; let's keep this on the list; I'm not sure there's a\n> lot\n>  to be learned from fiddling with this old version, but if we're\n> going\n>  to do it, let's at least record our attempts for posterity]\n> \n> On Thu, Mar 07, 2019 at 08:04:55PM +0100, Fabio Aiuto wrote:\n> \n> > I made a directory \"trial\" and inside it I ran init-db (that's the\n> > grand-father of git init) inside that directory. Then I created a\n> > file \n> > this way:\n> > \n> > echo 'helloooo!' >file.txt\n> > \n> > then then executed update-cache file.txt (thinking that's the\n> > ancestor\n> > of git add), but that doesn't work and it returns with a\n> > segmentation\n> > fault, due to the nullity of the header. But in this first commit\n> > how\n> > do I add a file in the cache? What's the right way to build up a\n> > repository from scratch with commit e83c5163316f?\n> \n> Hmm. I tried that, too, and got a segfault. Then I tried it again a\n> few\n> minutes later, and it worked.\n> \n> One thing that seems to provoke it consistently is having a zero-\n> length\n> index file (because that causes mmap to return NULL, and the code\n> does\n> not check for that case). Try this:\n> \n>   # This works.\n>   init-db\n>   echo content >file\n>   update-cache file\n> \n>   # This segfaults\n>   >.dircache/index\n>   update-cache file\n> \n>   # And this works again\n>   rm .dircache/index\n>   update-cache file\n> \n> I'm not sure why it would ever fail without that explicit empty-file\n> write. Perhaps there's some code path that writes out an empty index\n> file, and we inadvertently triggered it.\n> \n> If you're going to play with such an antique commit, you have to\n> expect\n> that things won't necessarily work, and be ready to poke around in\n> the\n> debugger.\n> \n> -Peff\n"}]}