Bug 1414792 - infinite loop in "git ls-tree" for broken symlink under refs/heads
Summary: infinite loop in "git ls-tree" for broken symlink under refs/heads
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: git
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Petr Stodulka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1204191 1204193
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-19 13:01 UTC by Leos Pol
Modified: 2017-01-21 19:22 UTC (History)
12 users (show)

Fixed In Version: git-2.9.3-2.fc25
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1204193
Environment:
Last Closed: 2017-01-21 19:22:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Leos Pol 2017-01-19 13:01:24 UTC
Regression found in git-core-2.9.3-1.fc25 and git-core-2.7.4-3.fc24

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

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.

--- Additional comment from  on 2015-03-23 11:10:08 EDT ---

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

--- Additional comment from  on 2015-03-26 07:46:59 EDT ---

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

--- Additional comment from Fedora Update System on 2015-06-23 02:18:11 EDT ---

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

--- Additional comment from Fedora Update System on 2015-06-23 02:18:20 EDT ---

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

--- Additional comment from Fedora Update System on 2015-06-24 11:55:37 EDT ---

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).

--- Additional comment from Fedora Update System on 2015-06-27 08:40:48 EDT ---

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.

--- Additional comment from Fedora Update System on 2015-07-03 14:48:26 EDT ---

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.

Comment 1 Petr Stodulka 2017-01-19 21:30:17 UTC
Possible reproducer:

$ mkdir foo_infinit
$ cd foo_infinit
$ git init testrepo
$ cd testrepo 
$ mkdir -p .git/refs/remotes
$ ln -s ../remotes/foo .git/refs/heads/bar
$ git ls-tree bar

Comment 2 Fedora Update System 2017-01-19 21:38:08 UTC
git-2.9.3-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-5f614d6917

Comment 3 Fedora Update System 2017-01-20 19:56:16 UTC
git-2.9.3-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5f614d6917

Comment 4 Fedora Update System 2017-01-21 19:22:33 UTC
git-2.9.3-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.