{"thread":{"id":"28777","subject":"Recent gits corrupts repository","startedAt":"2011-10-27T06:50:44Z","lastAt":"2011-10-27T07:30:59Z","messageCount":3,"participants":["Øyvind A. Holm","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"178342","messageId":"CAA787rnrG-mLRpq_a3xbbUyYuHz1kfdOzMqHQpxhBwc0rjt3Ww@mail.gmail.com","threadId":"28777","inReplyTo":null,"subject":"Recent gits corrupts repository","fromName":"Øyvind A. Holm","fromEmail":"sunny@sunbase.org","sentAt":"2011-10-27T06:50:44Z","receivedAt":"2011-10-27T06:50:44Z","isPatch":false,"sender":{"key":"sunny@sunbase.org","avatar":"https://avatars.githubusercontent.com/u/113445?v=4"},"body":"Something really weird is happening to a repository I'm working on, and\nit's only a problem in recent Gits. A bisect shows that from\nv1.7.6-1-g2548183 (\"fix phantom untracked files when core.ignorecase is\nset\") and newer, this happens:\n\n  $ git clone git://gitorious.org/tz/tzfiles.git\n  Cloning into tzfiles...\n  remote: Counting objects: 358, done.\n  remote: Compressing objects: 100% (352/352), done.\n  remote: Total 358 (delta 8), reused 343 (delta 3)\n  Receiving objects: 100% (358/358), 44.15 MiB | 3.76 MiB/s, done.\n  Resolving deltas: 100% (8/8), done.\n\n  $ cd tzfiles/\n\n  $ git status\n  git: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr)\n(((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct\nmalloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size)\n>= (unsigned long)((((__builtin_offsetof (struct malloc_chunk,\nfd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t)))\n- 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end &\npagemask) == 0)' failed.\n  Aborted\n\n  $ git status\n  *** glibc detected *** git: free(): invalid next size (normal): 0x089f5588 ***\n  ======= Backtrace: =========\n  /lib/tls/i686/cmov/libc.so.6(+0x6b591)[0xb74d3591]\n  /lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0xb74d4de8]\n  /lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0xb74d7ecd]\n  /lib/tls/i686/cmov/libc.so.6(+0x5c410)[0xb74c4410]\n  /lib/tls/i686/cmov/libc.so.6(fopen64+0x2c)[0xb74c69ec]\n  git[0x80c1fdd]\n  git[0x811b82b]\n  git[0x80637ea]\n  git[0x804bc87]\n  git[0x804be93]\n  /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb747ebd6]\n  git[0x804b521]\n  ======= Memory map: ========\n  08048000-08160000 r-xp 00000000 ca:00 2474445\n/usr/local/varprg/git.master.v1.7.7-419-g87009ed/bin/git\n  08160000-08161000 r--p 00117000 ca:00 2474445\n/usr/local/varprg/git.master.v1.7.7-419-g87009ed/bin/git\n  08161000-08166000 rw-p 00118000 ca:00 2474445\n/usr/local/varprg/git.master.v1.7.7-419-g87009ed/bin/git\n  08166000-081b0000 rw-p 00000000 00:00 0\n  089ec000-08a0d000 rw-p 00000000 00:00 0          [heap]\n  b7300000-b7321000 rw-p 00000000 00:00 0\n  b7321000-b7400000 ---p 00000000 00:00 0\n  b7444000-b7461000 r-xp 00000000 ca:00 24591      /lib/libgcc_s.so.1\n  b7461000-b7462000 r--p 0001c000 ca:00 24591      /lib/libgcc_s.so.1\n  b7462000-b7463000 rw-p 0001d000 ca:00 24591      /lib/libgcc_s.so.1\n  b7463000-b7464000 rw-p 00000000 00:00 0\n  b7464000-b7466000 r-xp 00000000 ca:00 1679643\n/lib/tls/i686/cmov/libdl-2.11.1.so\n  b7466000-b7467000 r--p 00001000 ca:00 1679643\n/lib/tls/i686/cmov/libdl-2.11.1.so\n  b7467000-b7468000 rw-p 00002000 ca:00 1679643\n/lib/tls/i686/cmov/libdl-2.11.1.so\n  b7468000-b75bb000 r-xp 00000000 ca:00 25961\n/lib/tls/i686/cmov/libc-2.11.1.so\n  b75bb000-b75bc000 ---p 00153000 ca:00 25961\n/lib/tls/i686/cmov/libc-2.11.1.so\n  b75bc000-b75be000 r--p 00153000 ca:00 25961\n/lib/tls/i686/cmov/libc-2.11.1.so\n  b75be000-b75bf000 rw-p 00155000 ca:00 25961\n/lib/tls/i686/cmov/libc-2.11.1.so\n  b75bf000-b75c3000 rw-p 00000000 00:00 0\n  b75c3000-b75d8000 r-xp 00000000 ca:00 1679654\n/lib/tls/i686/cmov/libpthread-2.11.1.so\n  b75d8000-b75d9000 r--p 00014000 ca:00 1679654\n/lib/tls/i686/cmov/libpthread-2.11.1.so\n  b75d9000-b75da000 rw-p 00015000 ca:00 1679654\n/lib/tls/i686/cmov/libpthread-2.11.1.so\n  b75da000-b75dc000 rw-p 00000000 00:00 0\n  b75dc000-b7714000 r-xp 00000000 ca:00 2007508\n/lib/i686/cmov/libcrypto.so.0.9.8\n  b7714000-b771c000 r--p 00137000 ca:00 2007508\n/lib/i686/cmov/libcrypto.so.0.9.8\n  b771c000-b772a000 rw-p 0013f000 ca:00 2007508\n/lib/i686/cmov/libcrypto.so.0.9.8\n  b772a000-b772e000 rw-p 00000000 00:00 0\n  b772e000-b7741000 r-xp 00000000 ca:00 24635      /lib/libz.so.1.2.3.3\n  b7741000-b7742000 r--p 00012000 ca:00 24635      /lib/libz.so.1.2.3.3\n  b7742000-b7743000 rw-p 00013000 ca:00 24635      /lib/libz.so.1.2.3.3\n  b774b000-b774f000 rw-p 00000000 00:00 0\n  b774f000-b776a000 r-xp 00000000 ca:00 25083      /lib/ld-2.11.1.so\n  b776a000-b776b000 r--p 0001a000 ca:00 25083      /lib/ld-2.11.1.so\n  b776b000-b776c000 rw-p 0001b000 ca:00 25083      /lib/ld-2.11.1.so\n  bfc1b000-bfc3c000 rw-p 00000000 00:00 0          [stack]\n  f57fe000-f57ff000 r-xp 00000000 00:00 0          [vdso]\n  Aborted\n\n  $\n\nReverting 2548183 fixes the problem.\n\nIt also seems that the behaviour is not consistent. Sometimes, after\nrunning the second \"git status\", this happens:\n\n  $ git st\n  error: index uses  extension, which we do not understand\n  fatal: index file corrupt\n\nAnd no, this is not memory corruption or something like that, the same\nthing happens on my laptop.\n\nAnother curious thing: When using an earlier git (for example v1.7.6 in\nthe example below) on this repo after a \"git status\" with a recent git,\nit segfaults. This indicates that recents Gits messes up something so\neven old gits won't work in that repo anymore. This is the last lines of\nan strace:\n\n  open(\".git/objects/pack\",\nO_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3\n  getdents64(3, /* 4 entries */, 32768)   = 192\n  access(\".git/objects/pack/pack-b9b05d1e8fed49138c1ffda8f0f2b7d7a8d31c6a.keep\",\nF_OK) = -1 ENOENT (No such file or directory)\n  stat64(\".git/objects/pack/pack-b9b05d1e8fed49138c1ffda8f0f2b7d7a8d31c6a.pack\",\n{st_mode=S_IFREG|0444, st_size=46297839, ...}) = 0\n  getdents64(3, /* 0 entries */, 32768)   = 0\n  close(3)                                = 0\n  open(\".git/objects/info/alternates\", O_RDONLY|O_LARGEFILE|O_NOATIME)\n= -1 ENOENT (No such file or directory)\n  open(\".git/objects/pack/pack-b9b05d1e8fed49138c1ffda8f0f2b7d7a8d31c6a.idx\",\nO_RDONLY|O_LARGEFILE|O_NOATIME) = 3\n  fstat64(3, {st_mode=S_IFREG|0444, st_size=11096, ...}) = 0\n  mmap2(NULL, 11096, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb76e1000\n  close(3)                                = 0\n  getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=1024}) = 0\n  open(\".git/objects/pack/pack-b9b05d1e8fed49138c1ffda8f0f2b7d7a8d31c6a.pack\",\nO_RDONLY|O_LARGEFILE|O_NOATIME) = 3\n  fstat64(3, {st_mode=S_IFREG|0444, st_size=46297839, ...}) = 0\n  fcntl64(3, F_GETFD)                     = 0\n  fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0\n  read(3, \"PACK\\0\\0\\0\\2\\0\\0\\1f\", 12)      = 12\n  _llseek(3, 46297819, [46297819], SEEK_SET) = 0\n  read(3, \",j\\212\\0375c\\335\\0k\\244)\\256\\376\\24\\v\\344\\6]0\\230\", 20) = 20\n  mmap2(NULL, 33554432, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb53fc000\n  open(\".git/info/grafts\", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such\nfile or directory)\n  open(\".git/shallow\", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file\nor directory)\n  brk(0x977e000)                          = 0x977e000\n  open(\"/proc/meminfo\", O_RDONLY)         = 4\n  fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0\n  mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,\n-1, 0) = 0xb76e0000\n  read(4, \"MemTotal:        1028684 kB\\nMemF\"..., 1024) = 1024\n  close(4)                                = 0\n  munmap(0xb76e0000, 4096)                = 0\n  access(\".git/info/exclude\", R_OK)       = 0\n  open(\".git/info/exclude\", O_RDONLY|O_LARGEFILE) = 4\n  fstat64(4, {st_mode=S_IFREG|0644, st_size=240, ...}) = 0\n  read(4, \"# git ls-files --others --exclud\"..., 240) = 240\n  close(4)                                = 0\n  access(\"/home/sunny/src/git/home-sunny/.gitexclude\", R_OK) = 0\n  open(\"/home/sunny/src/git/home-sunny/.gitexclude\", O_RDONLY|O_LARGEFILE) = 4\n  fstat64(4, {st_mode=S_IFREG|0644, st_size=86, ...}) = 0\n  read(4, \"\\n# ~/.gitexclude\\n# File ID: bcf6\"..., 86) = 86\n  close(4)                                = 0\n  open(\".\", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 4\n  getdents64(4, /* 7 entries */, 32768)   = 216\n  open(\".gitignore\", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file\nor directory)\n  --- SIGSEGV (Segmentation fault) @ 0 (0) ---\n  +++ killed by SIGSEGV +++\n\nComplete strace dump is stored at https://gist.github.com/1318830 .\n\nI'm currently using 1.7.7.419.g87009 , compiled with a regular \"make\"\nfrom the master branch. A quick test with newest master\n(v1.7.7.1-475-g997a194) shows the same error. Not installed properly,\nthough, as I haven't run the test suite yet.\n\nSystem info:\n\n  Ubuntu 10.04.3 LTS\n  gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3\n  GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303\n\nSame thing happens with Ubuntu 10.10 on my laptop.\n\nEven when creating a bundle and recloning, this happens. Also when\ninitialising a new, clean repo and fetching from the original local\nclone, same story.\n\nThe repository was created on 2011-10-08 06:54:00 +0200, and because I\ncreate a tag everytime I compile (using\n<https://github.com/sunny256/utils/blob/master/build-git>), I know the\nrepository was created with git v1.7.7-138-g7f41b6b.\n\nBecause Gmail probably will wrap long lines, a copy of this message is\nstored at <https://gist.github.com/1318935>.\n\nRegards,\nØyvind\n"},{"id":"178344","messageId":"vpqk47qc40s.fsf@bauges.imag.fr","threadId":"28777","inReplyTo":"CAA787rnrG-mLRpq_a3xbbUyYuHz1kfdOzMqHQpxhBwc0rjt3Ww@mail.gmail.com","subject":"Re: Recent gits corrupts repository","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-10-27T07:00:51Z","receivedAt":"2011-10-27T07:00:51Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Øyvind A. Holm <sunny@sunbase.org> writes:\n\n>   $ git status\n>   git: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr)\n> (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct\n> malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size)\n>>= (unsigned long)((((__builtin_offsetof (struct malloc_chunk,\n> fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t)))\n> - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end &\n> pagemask) == 0)' failed.\n>   Aborted\n\nThis looks very much like\n\n  http://thread.gmane.org/gmane.comp.version-control.git/184094\n\nfor which a patch is pending in \"next\":\n\n  8f41c07 read-cache.c: fix index memory allocation\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"178345","messageId":"CAA787rmRqacu62O0Mzo4QYT=7FeB92QPvFUCuSBJ5__KMw92pA@mail.gmail.com","threadId":"28777","inReplyTo":"vpqk47qc40s.fsf@bauges.imag.fr","subject":"Re: Recent gits corrupts repository","fromName":"Øyvind A. Holm","fromEmail":"sunny@sunbase.org","sentAt":"2011-10-27T07:30:59Z","receivedAt":"2011-10-27T07:30:59Z","isPatch":false,"sender":{"key":"sunny@sunbase.org","avatar":"https://avatars.githubusercontent.com/u/113445?v=4"},"body":"On 27 October 2011 09:00, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:\n> Øyvind A. Holm <sunny@sunbase.org> writes:\n> >   $ git status\n> >   git: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr)\n> > (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct\n> > malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size)\n> > >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk,\n> > fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t)))\n> > - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end &\n> > pagemask) == 0)' failed.\n> >   Aborted\n>\n> This looks very much like\n>\n>  http://thread.gmane.org/gmane.comp.version-control.git/184094\n>\n> for which a patch is pending in \"next\":\n>\n>  8f41c07 read-cache.c: fix index memory allocation\n\nArgh, that was some wasted hours, should have searched the mailing list\nfirst. But hey, I'm not complaining. :) Glad there's a fix coming up. I\ncherry-picked 8f41c07, and it seems to work nicely. Thanks.\n\nRegards,\nØyvind\n"}]}