Skip to contentSkip to conversation

git-update-server-info crashes on hera.kernel.org:/pub/scm/libs/klibc/klibc.git

DISCUSSION H. Peter Anvin 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

git-core-0.99.9j-1, and the backtrace is as follows:

: hera 29 ; ls -l /usr/lib/debug/usr/bin/git-update-
git-update-index.debug* git-update-ref.debug* git-update-server-info.debug*
: hera 29 ; gdb -s /usr/lib/debug/usr/bin/git-update-server-info.debug /usr/bin/git-update-server-info GNU gdb Red Hat Linux (6.3.0.0-1.63rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/git-update-server-info

Program received signal SIGSEGV, Segmentation fault.
0x0804c04c in nth_packed_object_sha1 (p=0x986a1f0, n=0, sha1=0xbfffc9f0 "") at sha1_file.c:1017
1017 memcpy(sha1, (index + 24 * n + 4), 20);
(gdb) where

#0  0x0804c04c in nth_packed_object_sha1 (p=0x986a1f0, n=0, sha1=0xbfffc9f0 "") at sha1_file.c:1017
#1  0x08049a61 in update_server_info (force=0) at server-info.c:248
#2  0x08049466 in main (ac=1, av=0xbfffeed4) at update-server-info.c:22
#3  0x00ce1e23 in __libc_start_main () from /lib/tls/libc.so.6
#4  0x080493a1 in _start ()

-hpa

#1 lore raw

I made a copy of that repository on hera and tried it but cannot reproduce (with or without -f flag -- and running under gdb with symbols did not make difference either). Sorry, I am baffled. The same machine, the same set of input and binary.

junio@hera:~/t(0)$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
junio@hera:~/t(0)$ (cd /pub/scm/libs/klibc/ && tar cf - klibc.git ) | tar xf -
junio@hera:~/t(0)$ head -n 4 klibc.git/objects/info/packs
P pack-122eb314270865bdaaded7d02c7340014537abbf.pack
D 0
T 0 005146812e1e36309409128e0bbaf86e6745a637 tag
T 0 00aea41acad6d139679416a79ff9139a50b5001c tag
junio@hera:~/t(0)$ GIT_DIR=klibc.git /usr/bin/git-update-server-info ; echo $?
0
junio@hera:~/t(0)$ head -n 4 klibc.git/objects/info/packs
P pack-1433c87e76496ad3f628652c0cb81d288c178fc5.pack
P pack-f9db0b232716d835858232fbecfb410d22ae5afb.pack
D 0
junio@hera:~/t(0)$ rm -fr klibc.git
junio@hera:~/t(0)$ (cd /pub/scm/libs/klibc/ && tar cf - klibc.git ) | tar xf -  junio@hera:~/t(0)$ head -n 4 klibc.git/objects/info/packs
P pack-122eb314270865bdaaded7d02c7340014537abbf.pack
D 0
T 0 005146812e1e36309409128e0bbaf86e6745a637 tag
T 0 00aea41acad6d139679416a79ff9139a50b5001c tag
junio@hera:~/t(0)$ GIT_DIR=klibc.git /usr/bin/git-update-server-info -f; echo $?
0
junio@hera:~/t(0)$ head -n 4 klibc.git/objects/info/packs
P pack-122eb314270865bdaaded7d02c7340014537abbf.pack
P pack-1433c87e76496ad3f628652c0cb81d288c178fc5.pack
P pack-f9db0b232716d835858232fbecfb410d22ae5afb.pack
D 0
junio@hera:~/t(0)$ exit
#2 lore raw
Quoted 5 lines · Junio C Hamano

I made a copy of that repository on hera and tried it but cannot reproduce (with or without -f flag -- and running under gdb with symbols did not make difference either). Sorry, I am baffled. The same machine, the same set of input and binary.

FWIW, I invoked this as:

hpa@hera:~(0)$ GIT_DIR=/pub/scm/libs/klibc/klibc.git git-update-server-info
Segmentation fault

-hpa

#3 lore raw
Quoted 4 lines · H. Peter Anvin

FWIW, I invoked this as:

hpa@hera:~(0)$ GIT_DIR=/pub/scm/libs/klibc/klibc.git git-update-server-info
Segmentation fault

Trusting that I *won't* be able to write into that repository, I tried to run that and after getting an error ("cannot update info/refs file", which I wanted to see) I seem to be getting the same segfault. GDB session reveals the binary is heavily optimized or inlined, so it is hard to see what it is doing though.

But there is one thing that is mysterious about your repository, and by mirroring that peculiarity with the copy in my home directory, I managed to reproduce the problem with my copy. Why does the objects/info/alternates in that repository point at itself? I suspect if you remove that file you will be OK.

update-server-info simply dying, instead of complaining about it, is a bug nevertheless, and removal of the unnecessary/possibly wrong alternate is only a workaround, but I hope that would unblock you in the meantime..

#4 lore raw
Quoted 22 lines · Junio C Hamano
Quoted 4 lines · H. Peter Anvin

FWIW, I invoked this as:

hpa@hera:~(0)$ GIT_DIR=/pub/scm/libs/klibc/klibc.git git-update-server-info
Segmentation fault

Trusting that I *won't* be able to write into that repository, I tried to run that and after getting an error ("cannot update info/refs file", which I wanted to see) I seem to be getting the same segfault. GDB session reveals the binary is heavily optimized or inlined, so it is hard to see what it is doing though.

But there is one thing that is mysterious about your repository, and by mirroring that peculiarity with the copy in my home directory, I managed to reproduce the problem with my copy. Why does the objects/info/alternates in that repository point at itself? I suspect if you remove that file you will be OK.

Quoted 5 lines

update-server-info simply dying, instead of complaining about it, is a bug nevertheless, and removal of the unnecessary/possibly wrong alternate is only a workaround, but I hope that would unblock you in the meantime..

Removing that file did indeed work. I have no idea where it comes from, though; although I would guess it comes from another repository that I merged with (which had my original repository set as an alternate.)

-hpa