A git19-git installation (being invoked via gitweb) goes into an infinite loop while serving pretty vanilla requests, if the refs/heads/ directory contains a symlink that's broken. Reproduction recipe: % git init % mkdir .git/refs/remotes % ln -s ../remotes/foo .git/refs/heads/bar % strace git --git-dir=`pwd`.git ls-tree bar [...] open("/sourceware1/home/fche/tmp2/.git/refs/heads/bar", O_RDONLY) = -1 ENOENT (No such file or directory) lstat("/sourceware1/home/fche/tmp2/.git/refs/heads/bar", {st_mode=S_IFLNK|0777, st_size=14, ...}) = 0 readlink("/sourceware1/home/fche/tmp2/.git/refs/heads/bar", "../remotes/foo", 255) = 14 open("/sourceware1/home/fche/tmp2/.git/refs/heads/bar", O_RDONLY) = -1 ENOENT (No such file or directory) lstat("/sourceware1/home/fche/tmp2/.git/refs/heads/bar", {st_mode=S_IFLNK|0777, st_size=14, ...}) = 0 readlink("/sourceware1/home/fche/tmp2/.git/refs/heads/bar", "../remotes/foo", 255) = 14 [...endlessly looping...] When gdb is sicced at it, the loop appears to be around line 1360..1401 of refs.c.
correction: -> % strace git --git-dir=`pwd`.git ls-tree bar % strace git --git-dir=`pwd`/.git ls-tree bar or just git ls-tree bar
I'm still able to replicate the issue with the latest build: # rpm -q rh-git29-git rh-git29-git-2.9.3-1.el7.x86_64 # cd /tmp # git init testrepo Initialized empty Git repository in /tmp/testrepo/.git/ # cd testrepo # mkdir -p .git/refs/remotes # ln -s ../remotes/foo .git/refs/heads/bar # timeout 10 git ls-tree bar # echo $? 124
Thanks for catch. Now it is fixed. Issue wasn't fixed maybe by mistake in upstream. I don't know why fix wasn't applied previously. So it is discussed in upstream now.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHEA-2016-2728.html