Bug 1204193

Summary: infinite loop in "git ls-tree" for broken symlink under refs/heads
Product: [Fedora] Fedora Reporter: Frank Ch. Eigler <fche>
Component: gitAssignee: Petr Stodulka <pstodulk>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 21CC: chrisw, jbowes, ooprala, pstodulk, qe-baseos-apps, tmz, vonsch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: git-2.1.0-5.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1204191
: 1414792 (view as bug list) Environment:
Last Closed: 2015-06-27 12:40:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1204191    
Bug Blocks: 1414792    

Description Frank Ch. Eigler 2015-03-20 14:53:16 UTC
This bug affects git-2.1.0-4.fc21.x86_64 also.


+++ This bug was initially created as a clone of Bug #1204191 +++

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.

Comment 1 Petr Stodulka 2015-03-23 15:10:08 UTC
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

Comment 2 Petr Stodulka 2015-03-26 11:46:59 UTC
Patches are proposed and wait for approval by upstream - or more precisely picked solution in upstream.

http://thread.gmane.org/gmane.comp.version-control.git/266145

Comment 3 Fedora Update System 2015-06-23 06:18:11 UTC
git-2.1.0-5.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/git-2.1.0-5.fc21

Comment 4 Fedora Update System 2015-06-23 06:18:20 UTC
git-2.4.3-4.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/git-2.4.3-4.fc22

Comment 5 Fedora Update System 2015-06-24 15:55:37 UTC
Package git-2.1.0-5.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing git-2.1.0-5.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-10565/git-2.1.0-5.fc21
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2015-06-27 12:40:48 UTC
git-2.4.3-4.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2015-07-03 18:48:26 UTC
git-2.1.0-5.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.