* Can't build first git commit @ 2019-03-04 19:58 Fabio Aiuto 2019-03-04 20:10 ` Santiago Torres 2019-03-04 20:40 ` Jeff King 0 siblings, 2 replies; 18+ messages in thread From: Fabio Aiuto @ 2019-03-04 19:58 UTC (permalink / raw) To: git Hi to all, I'm trying to build first commit of git made by Linus. I mean the one named e83c5163316f89bfbde7d9ab23... (I think this is enough). But at building stage i have the following error: make all gcc -g -o update-cache update-cache.o read-cache.o -lssl /usr/bin/ld: update-cache.o: undefined reference to symbol 'SHA1_Update@@OPENSSL_1_1_0' //usr/lib/i386-linux-gnu/libcrypto.so.1.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [update-cache] Errore 1 Makefile:16: set di istruzioni per l'obiettivo "update-cache" non riuscito I run a debian stretch on my machine. Could anyone help me? Thanks in advance. Fabio. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-04 19:58 Can't build first git commit Fabio Aiuto @ 2019-03-04 20:10 ` Santiago Torres 2019-03-04 20:19 ` Fabio Aiuto 2019-03-04 20:40 ` Jeff King 1 sibling, 1 reply; 18+ messages in thread From: Santiago Torres @ 2019-03-04 20:10 UTC (permalink / raw) To: Fabio Aiuto; +Cc: git [-- Attachment #1: Type: text/plain, Size: 1156 bytes --] This commit is about 14 years old: Date: Thu Apr 7 15:13:13 2005 -0700 Unless you have a toolchain from around that time, I'd be very surprised if things build. Notably, there you're having an issue with the symbols that lssl is exposing (I suspect you're not even using the openssl 1.0.0 series anymore. Thanks, -Santiago. On Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote: > Hi to all, > > I'm trying to build first commit of git made by Linus. I mean the one > named e83c5163316f89bfbde7d9ab23... (I think this is enough). > But at building stage i have the following error: > > make all > gcc -g -o update-cache update-cache.o read-cache.o -lssl > /usr/bin/ld: update-cache.o: undefined reference to symbol > 'SHA1_Update@@OPENSSL_1_1_0' > //usr/lib/i386-linux-gnu/libcrypto.so.1.1: error adding symbols: DSO > missing from command line > collect2: error: ld returned 1 exit status > make: *** [update-cache] Errore 1 > Makefile:16: set di istruzioni per l'obiettivo "update-cache" non > riuscito > > I run a debian stretch on my machine. Could anyone help me? > Thanks in advance. > Fabio. > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-04 20:10 ` Santiago Torres @ 2019-03-04 20:19 ` Fabio Aiuto 2019-03-04 20:22 ` Santiago Torres ` (2 more replies) 0 siblings, 3 replies; 18+ messages in thread From: Fabio Aiuto @ 2019-03-04 20:19 UTC (permalink / raw) To: Santiago Torres; +Cc: git What a pity, It would have been very useful for me, to debug around that simple version, to understand how everithing works. Thank you Santiago. Fabio. Il giorno lun, 04/03/2019 alle 15.10 -0500, Santiago Torres ha scritto: > This commit is about 14 years old: > > Date: Thu Apr 7 15:13:13 2005 -0700 > > Unless you have a toolchain from around that time, I'd be very > surprised > if things build. Notably, there you're having an issue with the > symbols > that lssl is exposing (I suspect you're not even using the openssl > 1.0.0 > series anymore. > > Thanks, > -Santiago. > > On Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote: > > Hi to all, > > > > I'm trying to build first commit of git made by Linus. I mean the > > one > > named e83c5163316f89bfbde7d9ab23... (I think this is enough). > > But at building stage i have the following error: > > > > make all > > gcc -g -o update-cache update-cache.o read-cache.o -lssl > > /usr/bin/ld: update-cache.o: undefined reference to symbol > > 'SHA1_Update@@OPENSSL_1_1_0' > > //usr/lib/i386-linux-gnu/libcrypto.so.1.1: error adding symbols: > > DSO > > missing from command line > > collect2: error: ld returned 1 exit status > > make: *** [update-cache] Errore 1 > > Makefile:16: set di istruzioni per l'obiettivo "update-cache" non > > riuscito > > > > I run a debian stretch on my machine. Could anyone help me? > > Thanks in advance. > > Fabio. > > ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-04 20:19 ` Fabio Aiuto @ 2019-03-04 20:22 ` Santiago Torres 2019-03-04 21:48 ` asymptosis 2019-03-04 22:25 ` Jonathan Nieder 2 siblings, 0 replies; 18+ messages in thread From: Santiago Torres @ 2019-03-04 20:22 UTC (permalink / raw) To: Fabio Aiuto; +Cc: git [-- Attachment #1: Type: text/plain, Size: 1983 bytes --] It happens. Something that I liked playing with to get myself a better handle of how git works is using libgit2 and its python bindings. I find the codebase a little bit smaller and its bindings to higher-level languages can help you abstract the memory management and other low-level stuff that is sometimes distracting. Good luck! -Santiago. On Mon, Mar 04, 2019 at 09:19:52PM +0100, Fabio Aiuto wrote: > What a pity, It would have been very useful for me, to debug around > that simple version, to understand how everithing works. > Thank you Santiago. > Fabio. > Il giorno lun, 04/03/2019 alle 15.10 -0500, Santiago Torres ha scritto: > > This commit is about 14 years old: > > > > Date: Thu Apr 7 15:13:13 2005 -0700 > > > > Unless you have a toolchain from around that time, I'd be very > > surprised > > if things build. Notably, there you're having an issue with the > > symbols > > that lssl is exposing (I suspect you're not even using the openssl > > 1.0.0 > > series anymore. > > > > Thanks, > > -Santiago. > > > > On Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote: > > > Hi to all, > > > > > > I'm trying to build first commit of git made by Linus. I mean the > > > one > > > named e83c5163316f89bfbde7d9ab23... (I think this is enough). > > > But at building stage i have the following error: > > > > > > make all > > > gcc -g -o update-cache update-cache.o read-cache.o -lssl > > > /usr/bin/ld: update-cache.o: undefined reference to symbol > > > 'SHA1_Update@@OPENSSL_1_1_0' > > > //usr/lib/i386-linux-gnu/libcrypto.so.1.1: error adding symbols: > > > DSO > > > missing from command line > > > collect2: error: ld returned 1 exit status > > > make: *** [update-cache] Errore 1 > > > Makefile:16: set di istruzioni per l'obiettivo "update-cache" non > > > riuscito > > > > > > I run a debian stretch on my machine. Could anyone help me? > > > Thanks in advance. > > > Fabio. > > > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-04 20:19 ` Fabio Aiuto 2019-03-04 20:22 ` Santiago Torres @ 2019-03-04 21:48 ` asymptosis 2019-03-04 22:25 ` Jonathan Nieder 2 siblings, 0 replies; 18+ messages in thread From: asymptosis @ 2019-03-04 21:48 UTC (permalink / raw) To: Fabio Aiuto; +Cc: git On Mon, Mar 04, 2019 at 09:19:52PM +0100, Fabio Aiuto wrote: > What a pity, It would have been very useful for me, to debug around > that simple version, to understand how everithing works. To understand how Git works, it is a good idea to work through the "Git Internals" chapter in the Git Book: https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain To help me understand that chapter, I started re-implementing Git as simple bash scripts, which have been placed at https://notabug.org/cryptarch/sgit ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-04 20:19 ` Fabio Aiuto 2019-03-04 20:22 ` Santiago Torres 2019-03-04 21:48 ` asymptosis @ 2019-03-04 22:25 ` Jonathan Nieder 2 siblings, 0 replies; 18+ messages in thread From: Jonathan Nieder @ 2019-03-04 22:25 UTC (permalink / raw) To: Fabio Aiuto; +Cc: Santiago Torres, git, asymptosis, Jeff King Hi, Fabio Aiuto wrote: > What a pity, It would have been very useful for me, to debug around > that simple version, to understand how everithing works. Jeff King suggested how you can update the build command to get it working. In general, I think people sometimes overthink what is involved in a build: something like cc *.c plus appropriate warning, optimization, debug, -D, and library flags should work just fine. If you haven't already read it, I also recommend reading https://www.kernel.org/pub/software/scm/git/docs/user-manual.html#hacking-git. If you have ideas for improving the text there (perhaps with suggested build instructions?), patches to Documentation/user-manual.txt are very welcome. Thanks and happy hacking, Jonathan ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-04 19:58 Can't build first git commit Fabio Aiuto 2019-03-04 20:10 ` Santiago Torres @ 2019-03-04 20:40 ` Jeff King 2019-03-05 18:42 ` Fabio Aiuto 2019-03-05 19:15 ` Jeff King 1 sibling, 2 replies; 18+ messages in thread From: Jeff King @ 2019-03-04 20:40 UTC (permalink / raw) To: Fabio Aiuto; +Cc: git On Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote: > I'm trying to build first commit of git made by Linus. I mean the one > named e83c5163316f89bfbde7d9ab23... (I think this is enough). > But at building stage i have the following error: > > make all > gcc -g -o update-cache update-cache.o read-cache.o -lssl > /usr/bin/ld: update-cache.o: undefined reference to symbol > 'SHA1_Update@@OPENSSL_1_1_0' The sha1 routines are in libcrypto. See 3be4b61aa4 (Link with -lcrypto instead of -lssl when using openssl libraries., 2005-05-10). I also needed -lz. See 9426167765 (Add "-lz" to link line to get in zlib., 2005-04-08). You can patch the Makefile, or just override it like: make LIBS='-lcrypto -lz' which builds for me on current Debian unstable. I don't think you can actually fetch with that old build, but I used periodically check that Git v1.0 can fetch happily from GitHub. I haven't in a while, so let me know if you try it and it doesn't work. ;) -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-04 20:40 ` Jeff King @ 2019-03-05 18:42 ` Fabio Aiuto 2019-03-05 19:15 ` Jeff King 1 sibling, 0 replies; 18+ messages in thread From: Fabio Aiuto @ 2019-03-05 18:42 UTC (permalink / raw) To: Jeff King; +Cc: git Thank you Jeff I'll have news within few days!!! Il giorno lun, 04/03/2019 alle 15.40 -0500, Jeff King ha scritto: > On Mon, Mar 04, 2019 at 08:58:37PM +0100, Fabio Aiuto wrote: > > > I'm trying to build first commit of git made by Linus. I mean the > > one > > named e83c5163316f89bfbde7d9ab23... (I think this is enough). > > But at building stage i have the following error: > > > > make all > > gcc -g -o update-cache update-cache.o read-cache.o -lssl > > /usr/bin/ld: update-cache.o: undefined reference to symbol > > 'SHA1_Update@@OPENSSL_1_1_0' > > The sha1 routines are in libcrypto. See 3be4b61aa4 (Link with > -lcrypto > instead of -lssl when using openssl libraries., 2005-05-10). I also > needed -lz. See 9426167765 (Add "-lz" to link line to get in zlib., > 2005-04-08). > > You can patch the Makefile, or just override it like: > > make LIBS='-lcrypto -lz' > > which builds for me on current Debian unstable. I don't think you can > actually fetch with that old build, but I used periodically check > that > Git v1.0 can fetch happily from GitHub. I haven't in a while, so let > me > know if you try it and it doesn't work. ;) > > -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-04 20:40 ` Jeff King 2019-03-05 18:42 ` Fabio Aiuto @ 2019-03-05 19:15 ` Jeff King 2019-03-06 19:58 ` Fabio Aiuto 1 sibling, 1 reply; 18+ messages in thread From: Jeff King @ 2019-03-05 19:15 UTC (permalink / raw) To: Fabio Aiuto; +Cc: git On Mon, Mar 04, 2019 at 03:40:07PM -0500, Jeff King wrote: > You can patch the Makefile, or just override it like: > > make LIBS='-lcrypto -lz' > > which builds for me on current Debian unstable. I don't think you can > actually fetch with that old build, but I used periodically check that > Git v1.0 can fetch happily from GitHub. I haven't in a while, so let me > know if you try it and it doesn't work. ;) I just tried this, and it does indeed work. I had to build v1.0.0 with make NO_OPENSSL=Nope I think the issue is that some old code embedded openssl's BIGNUM in a struct, and later versions of openssl stopped publicly defining the types. I was able to clone git://github.com/git/git with the result, though of course it chokes no the sha1collisiondetection submodule. You can still use "git log", though, and checkout older commits. -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-05 19:15 ` Jeff King @ 2019-03-06 19:58 ` Fabio Aiuto 2019-03-06 20:03 ` Jeff King 0 siblings, 1 reply; 18+ messages in thread From: Fabio Aiuto @ 2019-03-06 19:58 UTC (permalink / raw) To: Jeff King; +Cc: git Il giorno mar, 05/03/2019 alle 14.15 -0500, Jeff King ha scritto: > On Mon, Mar 04, 2019 at 03:40:07PM -0500, Jeff King wrote: > > > You can patch the Makefile, or just override it like: > > > > make LIBS='-lcrypto -lz' > > > > which builds for me on current Debian unstable. I don't think you > > can > > actually fetch with that old build, but I used periodically check > > that > > Git v1.0 can fetch happily from GitHub. I haven't in a while, so > > let me > > know if you try it and it doesn't work. ;) > > I just tried this, and it does indeed work. I had to build v1.0.0 > with > > make NO_OPENSSL=Nope > > I think the issue is that some old code embedded openssl's BIGNUM in > a > struct, and later versions of openssl stopped publicly defining the > types. > > I was able to clone git://github.com/git/git with the result, though > of > course it chokes no the sha1collisiondetection submodule. You can > still > use "git log", though, and checkout older commits. > > -Peff Hi Jeff, I've just typed make make LIBS='-lcrypto -lz' from the shell inside the directory containing the whole first commit and it seems to work. I trace all through the code. Yes the fetch command wasn't written at that time, right? I didn't understand why should be better to work with the git code from github. There's something I misunderstood? Thank you Jeff ;-) ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-06 19:58 ` Fabio Aiuto @ 2019-03-06 20:03 ` Jeff King 2019-03-06 20:19 ` Fabio Aiuto 2019-03-06 20:52 ` Fabio Aiuto 0 siblings, 2 replies; 18+ messages in thread From: Jeff King @ 2019-03-06 20:03 UTC (permalink / raw) To: Fabio Aiuto; +Cc: git On Wed, Mar 06, 2019 at 08:58:40PM +0100, Fabio Aiuto wrote: > Yes the fetch command wasn't written at that time, right? I didn't > understand why should be better to work with the git code from github. > There's something I misunderstood? I just mean that it is an interesting fact that modern Git and Git v1.0 can still interact seamlessly over the network. I.e., you could still collaborate with somebody using an ancient version of Git (hopefully nobody is using v1.0, but logically it extends to all of the intermediate versions). -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-06 20:03 ` Jeff King @ 2019-03-06 20:19 ` Fabio Aiuto 2019-03-06 20:39 ` Santiago Torres 2019-03-06 20:52 ` Fabio Aiuto 1 sibling, 1 reply; 18+ messages in thread From: Fabio Aiuto @ 2019-03-06 20:19 UTC (permalink / raw) To: Jeff King; +Cc: git Yes that's great. Why somebody told me about a outdate toolchain when I started this little thread about first git compiling? Sorry for my stupid question but the you just resolved with that make override... Maybe there's something I have to know? Il giorno mer, 06/03/2019 alle 15.03 -0500, Jeff King ha scritto: > On Wed, Mar 06, 2019 at 08:58:40PM +0100, Fabio Aiuto wrote: > > > Yes the fetch command wasn't written at that time, right? I didn't > > understand why should be better to work with the git code from > > github. > > There's something I misunderstood? > > I just mean that it is an interesting fact that modern Git and Git > v1.0 > can still interact seamlessly over the network. I.e., you could still > collaborate with somebody using an ancient version of Git (hopefully > nobody is using v1.0, but logically it extends to all of the > intermediate versions). > > -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-06 20:19 ` Fabio Aiuto @ 2019-03-06 20:39 ` Santiago Torres 2019-03-06 21:54 ` Jeff King 0 siblings, 1 reply; 18+ messages in thread From: Santiago Torres @ 2019-03-06 20:39 UTC (permalink / raw) To: Fabio Aiuto; +Cc: Jeff King, git [-- Attachment #1: Type: text/plain, Size: 1367 bytes --] That was proably my bad. I still find it somewhat astounding that it compiles with a modern toolchain after 15+ years. Many projects fail to do so (it's an understandably high bar to have). I'm glad this is possible and you were able to do so (maybe you want to share your experiences about it somewhere? :)) Cheers! -Santiago. On Wed, Mar 06, 2019 at 09:19:58PM +0100, Fabio Aiuto wrote: > Yes that's great. > Why somebody told me about a outdate toolchain when I started this > little thread about first git compiling? Sorry for my stupid question > but the you just resolved with that make override... > Maybe there's something I have to know? > > Il giorno mer, 06/03/2019 alle 15.03 -0500, Jeff King ha scritto: > > On Wed, Mar 06, 2019 at 08:58:40PM +0100, Fabio Aiuto wrote: > > > > > Yes the fetch command wasn't written at that time, right? I didn't > > > understand why should be better to work with the git code from > > > github. > > > There's something I misunderstood? > > > > I just mean that it is an interesting fact that modern Git and Git > > v1.0 > > can still interact seamlessly over the network. I.e., you could still > > collaborate with somebody using an ancient version of Git (hopefully > > nobody is using v1.0, but logically it extends to all of the > > intermediate versions). > > > > -Peff [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-06 20:39 ` Santiago Torres @ 2019-03-06 21:54 ` Jeff King 0 siblings, 0 replies; 18+ messages in thread From: Jeff King @ 2019-03-06 21:54 UTC (permalink / raw) To: Santiago Torres; +Cc: Fabio Aiuto, git On Wed, Mar 06, 2019 at 03:39:11PM -0500, Santiago Torres wrote: > I still find it somewhat astounding that it compiles with a modern > toolchain after 15+ years. Many projects fail to do so (it's an > understandably high bar to have). I think the key thing is that Git has very few external dependencies. You'll note that I had to turn off OpenSSL support to get it to compile. The only other library from back then is libz, which is extremely stable. Other than, it just depends on a reasonable C compiler and a POSIX libc, both of which have been standardized for decades. I suspect that today's Git will also compile pretty well in 15 years, but you'll probably to say NO_GETTEXT and turn a few other knobs. Libcurl might eventually be a problem, though I've been pretty impressed with its stability and backwards-compatibility so far (and of course it's optional if disabling http support is OK). -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-06 20:03 ` Jeff King 2019-03-06 20:19 ` Fabio Aiuto @ 2019-03-06 20:52 ` Fabio Aiuto 2019-03-06 21:57 ` Jeff King 1 sibling, 1 reply; 18+ messages in thread From: Fabio Aiuto @ 2019-03-06 20:52 UTC (permalink / raw) To: Jeff King; +Cc: git Found this error Program received signal SIGSEGV, Segmentation fault. 0x00401628 in verify_hdr (hdr=0x0, size=32) at read-cache.c:192 192 if (hdr->signature != CACHE_SIGNATURE) when tracing on line static int verify_hdr(struct cache_header *hdr, unsigned long size) { SHA_CTX c; unsigned char sha1[20]; if (hdr->signature != CACHE_SIGNATURE)<--- this line inside file read-cache.c What's going on? Il giorno mer, 06/03/2019 alle 15.03 -0500, Jeff King ha scritto: > On Wed, Mar 06, 2019 at 08:58:40PM +0100, Fabio Aiuto wrote: > > > Yes the fetch command wasn't written at that time, right? I didn't > > understand why should be better to work with the git code from > > github. > > There's something I misunderstood? > > I just mean that it is an interesting fact that modern Git and Git > v1.0 > can still interact seamlessly over the network. I.e., you could still > collaborate with somebody using an ancient version of Git (hopefully > nobody is using v1.0, but logically it extends to all of the > intermediate versions). > > -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-06 20:52 ` Fabio Aiuto @ 2019-03-06 21:57 ` Jeff King [not found] ` <1551985495.1606.1.camel@libero.it> 0 siblings, 1 reply; 18+ messages in thread From: Jeff King @ 2019-03-06 21:57 UTC (permalink / raw) To: Fabio Aiuto; +Cc: git On Wed, Mar 06, 2019 at 09:52:59PM +0100, Fabio Aiuto wrote: > Found this error > > Program received signal SIGSEGV, Segmentation fault. > 0x00401628 in verify_hdr (hdr=0x0, size=32) at read-cache.c:192 > 192 if (hdr->signature != CACHE_SIGNATURE) > > when tracing on line > > static int verify_hdr(struct cache_header *hdr, unsigned long size) > { > SHA_CTX c; > unsigned char sha1[20]; > > if (hdr->signature != CACHE_SIGNATURE)<--- this line > > inside file read-cache.c > What's going on? Well, hdr is NULL, so you can't dereference it. Without knowing more about how you called it, it's hard to say. But do note that the index format has been updated once or twice (as well as the pack format). You probably can't just chdir into a clone made by a recent Git and expect ancient versions to read it. You'll have to start a repo from scratch, or clone an existing with the old version (which will be tricky; you might have to use a modern upload-pack to represent the server side, but I think that first version doesn't even have any fetch capabilities at all). It might also be possible to convince modern Git to write out in old formats that ancient Git will understand, but I don't know the right config knobs to tweak offhand. -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <1551985495.1606.1.camel@libero.it>]
* Re: Can't build first git commit [not found] ` <1551985495.1606.1.camel@libero.it> @ 2019-03-07 19:41 ` Jeff King 2019-03-07 20:07 ` Fabio Aiuto 0 siblings, 1 reply; 18+ messages in thread From: Jeff King @ 2019-03-07 19:41 UTC (permalink / raw) To: Fabio Aiuto; +Cc: git [+cc git@vger; let's keep this on the list; I'm not sure there's a lot to be learned from fiddling with this old version, but if we're going to do it, let's at least record our attempts for posterity] On Thu, Mar 07, 2019 at 08:04:55PM +0100, Fabio Aiuto wrote: > I made a directory "trial" and inside it I ran init-db (that's the > grand-father of git init) inside that directory. Then I created a file > this way: > > echo 'helloooo!' >file.txt > > then then executed update-cache file.txt (thinking that's the ancestor > of git add), but that doesn't work and it returns with a segmentation > fault, due to the nullity of the header. But in this first commit how > do I add a file in the cache? What's the right way to build up a > repository from scratch with commit e83c5163316f? Hmm. I tried that, too, and got a segfault. Then I tried it again a few minutes later, and it worked. One thing that seems to provoke it consistently is having a zero-length index file (because that causes mmap to return NULL, and the code does not check for that case). Try this: # This works. init-db echo content >file update-cache file # This segfaults >.dircache/index update-cache file # And this works again rm .dircache/index update-cache file I'm not sure why it would ever fail without that explicit empty-file write. Perhaps there's some code path that writes out an empty index file, and we inadvertently triggered it. If you're going to play with such an antique commit, you have to expect that things won't necessarily work, and be ready to poke around in the debugger. -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Can't build first git commit 2019-03-07 19:41 ` Jeff King @ 2019-03-07 20:07 ` Fabio Aiuto 0 siblings, 0 replies; 18+ messages in thread From: Fabio Aiuto @ 2019-03-07 20:07 UTC (permalink / raw) To: Jeff King; +Cc: git Sorry for forgetting the cc!!! Thank you so much for help, hope not to bore you all ;) I think that I will go on studying git this way, and follow all the improvements that were made along his history. I think that asymptosis too gave me a good link, related to that bash script implmentation. Thank you Jeff, now I'm trying to understand how could I show the contents of the index in that version. Fabio. Il giorno gio, 07/03/2019 alle 14.41 -0500, Jeff King ha scritto: > [+cc git@vger; let's keep this on the list; I'm not sure there's a > lot > to be learned from fiddling with this old version, but if we're > going > to do it, let's at least record our attempts for posterity] > > On Thu, Mar 07, 2019 at 08:04:55PM +0100, Fabio Aiuto wrote: > > > I made a directory "trial" and inside it I ran init-db (that's the > > grand-father of git init) inside that directory. Then I created a > > file > > this way: > > > > echo 'helloooo!' >file.txt > > > > then then executed update-cache file.txt (thinking that's the > > ancestor > > of git add), but that doesn't work and it returns with a > > segmentation > > fault, due to the nullity of the header. But in this first commit > > how > > do I add a file in the cache? What's the right way to build up a > > repository from scratch with commit e83c5163316f? > > Hmm. I tried that, too, and got a segfault. Then I tried it again a > few > minutes later, and it worked. > > One thing that seems to provoke it consistently is having a zero- > length > index file (because that causes mmap to return NULL, and the code > does > not check for that case). Try this: > > # This works. > init-db > echo content >file > update-cache file > > # This segfaults > >.dircache/index > update-cache file > > # And this works again > rm .dircache/index > update-cache file > > I'm not sure why it would ever fail without that explicit empty-file > write. Perhaps there's some code path that writes out an empty index > file, and we inadvertently triggered it. > > If you're going to play with such an antique commit, you have to > expect > that things won't necessarily work, and be ready to poke around in > the > debugger. > > -Peff ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2019-03-07 20:07 UTC | newest] Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-03-04 19:58 Can't build first git commit Fabio Aiuto 2019-03-04 20:10 ` Santiago Torres 2019-03-04 20:19 ` Fabio Aiuto 2019-03-04 20:22 ` Santiago Torres 2019-03-04 21:48 ` asymptosis 2019-03-04 22:25 ` Jonathan Nieder 2019-03-04 20:40 ` Jeff King 2019-03-05 18:42 ` Fabio Aiuto 2019-03-05 19:15 ` Jeff King 2019-03-06 19:58 ` Fabio Aiuto 2019-03-06 20:03 ` Jeff King 2019-03-06 20:19 ` Fabio Aiuto 2019-03-06 20:39 ` Santiago Torres 2019-03-06 21:54 ` Jeff King 2019-03-06 20:52 ` Fabio Aiuto 2019-03-06 21:57 ` Jeff King [not found] ` <1551985495.1606.1.camel@libero.it> 2019-03-07 19:41 ` Jeff King 2019-03-07 20:07 ` Fabio Aiuto
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).