fix inifinite loop due to broken symlink and new requires in git-svn

This commit is contained in:
Petr Stodulka 2015-06-22 19:23:03 +02:00
parent 0338f401b4
commit ffa0047cf6
2 changed files with 52 additions and 1 deletions

39
git-infinite-loop.patch Normal file
View File

@ -0,0 +1,39 @@
diff --git a/refs.c b/refs.c
index 67d6745..ddb9a77 100644
--- a/refs.c
+++ b/refs.c
@@ -1422,6 +1422,7 @@ static struct ref_dir *get_loose_refs(struct ref_cache *refs)
/* We allow "recursive" symbolic refs. Only within reason, though */
#define MAXDEPTH 5
#define MAXREFLEN (1024)
+#define MAXRETRIES 5
/*
* Called by resolve_gitlink_ref_recursive() after it failed to read
@@ -1576,6 +1577,7 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags, unsigned
struct stat st;
char *buf;
int fd;
+ int retries = 0;
if (--depth < 0) {
errno = ELOOP;
@@ -1612,7 +1614,8 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags, unsigned
if (S_ISLNK(st.st_mode)) {
len = readlink(path, buffer, sizeof(buffer)-1);
if (len < 0) {
- if (errno == ENOENT || errno == EINVAL)
+ if ((errno == ENOENT || errno == EINVAL) &&
+ retries++ < MAXRETRIES)
/* inconsistent with lstat; retry */
goto stat_ref;
else
@@ -1645,7 +1648,7 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags, unsigned
*/
fd = open(path, O_RDONLY);
if (fd < 0) {
- if (errno == ENOENT)
+ if (errno == ENOENT && retries++ < MAXRETRIES)
/* inconsistent with lstat; retry */
goto stat_ref;
else

View File

@ -44,7 +44,7 @@
Name: git
Version: 2.4.4
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Fast Version Control System
License: GPLv2
Group: Development/Tools
@ -64,6 +64,10 @@ Patch0: git-1.8-gitweb-home-link.patch
Patch1: git-cvsimport-Ignore-cvsps-2.2b1-Branches-output.patch
# https://bugzilla.redhat.com/600411
Patch3: git-1.7-el5-emacs-support.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1204193
# http://thread.gmane.org/gmane.comp.version-control.git/266145
# could be removed when update/branch of Michael will be merged in upstream
Patch4: git-infinite-loop.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -206,6 +210,7 @@ Requires: git = %{version}-%{release}
Summary: Git tools for importing Subversion repositories
Group: Development/Tools
Requires: git = %{version}-%{release}, subversion
Requires: perl-Digest-MD5
%if ! %{defined perl_bootstrap}
Requires: perl(Term::ReadKey)
%endif
@ -315,6 +320,7 @@ Requires: emacs-git = %{version}-%{release}
%if %{emacs_old}
%patch3 -p1
%endif
%patch4 -p1
%if %{use_prebuilt_docs}
mkdir -p prebuilt_docs/{html,man}
@ -654,6 +660,12 @@ rm -rf %{buildroot}
# No files for you!
%changelog
* Mon Jun 22 2015 Petr Stodulka <pstodulk@gmail.com> - 2.4.4-2
- git-svn - added requires for perl-Digest-MD5 (#1218176)
- solve troubles with infinite loop due to broken symlink (probably
shouldn't be problem here, but it's reproducible manually)
(#1204193)
* Tue Jun 16 2015 Jon Ciesla <limburgher@gmail.com> - 2.4.4-1
- Update to 2.4.4.