Update to 2.9.0.

This commit is contained in:
Elliott Sales de Andrade 2020-01-01 22:08:15 -05:00
parent 9deed689c9
commit 735691f445
5 changed files with 9 additions and 198 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@
/git-lfs-2.7.1.tar.gz
/git-lfs-2.7.2.tar.gz
/git-lfs-v2.8.0.tar.gz
/git-lfs-v2.9.0.tar.gz

View File

@ -1,61 +0,0 @@
From f06492430e8f4a37136c746a29cffb7149beae08 Mon Sep 17 00:00:00 2001
From: "brian m. carlson" <bk2204@github.com>
Date: Wed, 14 Aug 2019 14:49:48 +0000
Subject: [PATCH] lfsapi: fix URL parsing with Go 1.12.8
Go 1.12.8 introduces a security fix for parsing URLs that contain a
colon followed by an invalid port number. Since our SSH remotes can
contain just such a colon, our hack to make these into URLs no longer
works.
Fix this by replacing the first colon in these "URLs" with a slash,
which is a path delimiter, which makes them parsable by newer versions
of Go. Update the name of the function since it now does more than its
previous name implies.
---
lfsapi/auth.go | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lfsapi/auth.go b/lfsapi/auth.go
index 5a99a5b01..1de332e99 100644
--- a/lfsapi/auth.go
+++ b/lfsapi/auth.go
@@ -192,7 +192,7 @@ func getCredURLForAPI(ef EndpointFinder, operation, remote string, apiEndpoint l
if len(remote) > 0 {
if u := ef.GitRemoteURL(remote, operation == "upload"); u != "" {
- schemedUrl, _ := prependEmptySchemeIfAbsent(u)
+ schemedUrl, _ := fixSchemelessURL(u)
gitRemoteURL, err := url.Parse(schemedUrl)
if err != nil {
@@ -214,12 +214,13 @@ func getCredURLForAPI(ef EndpointFinder, operation, remote string, apiEndpoint l
return apiURL, nil
}
-// prependEmptySchemeIfAbsent prepends an empty scheme "//" if none was found in
-// the URL in order to satisfy RFC 3986 §3.3, and `net/url.Parse()`.
+// fixSchemelessURL prepends an empty scheme "//" if none was found in
+// the URL and replaces the first colon with a slash in order to satisfy RFC
+// 3986 §3.3, and `net/url.Parse()`.
//
// It returns a string parse-able with `net/url.Parse()` and a boolean whether
// or not an empty scheme was added.
-func prependEmptySchemeIfAbsent(u string) (string, bool) {
+func fixSchemelessURL(u string) (string, bool) {
if hasScheme(u) {
return u, false
}
@@ -231,7 +232,11 @@ func prependEmptySchemeIfAbsent(u string) (string, bool) {
// First path segment has a colon, assumed that it's a
// scheme-less URL. Append an empty scheme on top to
// satisfy RFC 3986 §3.3, and `net/url.Parse()`.
- return fmt.Sprintf("//%s", u), true
+ //
+ // In addition, replace the first colon with a slash since
+ // otherwise the colon looks like it's introducing a port
+ // number.
+ return fmt.Sprintf("//%s", strings.Replace(u, ":", "/", 1)), true
}
return u, true
}

View File

@ -1,124 +0,0 @@
From d1ee735a4aacb80d9c3c4c34fc4317c6eef6718a Mon Sep 17 00:00:00 2001
From: "brian m. carlson" <bk2204@github.com>
Date: Wed, 28 Aug 2019 21:02:26 +0000
Subject: [PATCH] Avoid deadlock when transfer queue fails
In 1412d6e4 ("Don't fail if we lack objects the server has",
2019-04-30), we changed the code to abort later if a missing object
occurs. In doing so, we had to consider the case where the transfer
queue aborts early for some reason and ensure that the sync.WaitGroup
does not unnecessarily block due to outstanding objects never getting
processed.
However, the approach we used, which was to explicitly add the number of
items we skipped processing, was error prone and didn't cover all cases.
Notably, a DNS failure could randomly cause a hang during a push. Solve
this by creating a class for a wait group which is abortable and simply
abort it if we encounter an error, preventing any deadlocks caused by
miscounting the number of items.
---
tq/transfer_queue.go | 55 ++++++++++++++++++++++++++++++++++----------
1 file changed, 43 insertions(+), 12 deletions(-)
diff --git a/tq/transfer_queue.go b/tq/transfer_queue.go
index 89296a646..7d39fe581 100644
--- a/tq/transfer_queue.go
+++ b/tq/transfer_queue.go
@@ -123,6 +123,43 @@ func (b batch) Len() int { return len(b) }
func (b batch) Less(i, j int) bool { return b[i].Size < b[j].Size }
func (b batch) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
+type abortableWaitGroup struct {
+ wq sync.WaitGroup
+ counter int
+ mu sync.Mutex
+}
+
+func newAbortableWaitQueue() *abortableWaitGroup {
+ return &abortableWaitGroup{}
+}
+
+func (q *abortableWaitGroup) Add(delta int) {
+ q.mu.Lock()
+ defer q.mu.Unlock()
+
+ q.counter += delta
+ q.wq.Add(delta)
+}
+
+func (q *abortableWaitGroup) Done() {
+ q.mu.Lock()
+ defer q.mu.Unlock()
+
+ q.counter -= 1
+ q.wq.Done()
+}
+
+func (q *abortableWaitGroup) Abort() {
+ q.mu.Lock()
+ defer q.mu.Unlock()
+
+ q.wq.Add(-q.counter)
+}
+
+func (q *abortableWaitGroup) Wait() {
+ q.wq.Wait()
+}
+
// TransferQueue organises the wider process of uploading and downloading,
// including calling the API, passing the actual transfer request to transfer
// adapters, and dealing with progress, errors and retries.
@@ -150,7 +187,7 @@ type TransferQueue struct {
// wait is used to keep track of pending transfers. It is incremented
// once per unique OID on Add(), and is decremented when that transfer
// is marked as completed or failed, but not retried.
- wait sync.WaitGroup
+ wait *abortableWaitGroup
manifest *Manifest
rc *retryCounter
@@ -250,6 +287,7 @@ func NewTransferQueue(dir Direction, manifest *Manifest, remote string, options
trMutex: &sync.Mutex{},
manifest: manifest,
rc: newRetryCounter(),
+ wait: newAbortableWaitQueue(),
}
for _, opt := range options {
@@ -401,8 +439,11 @@ func (q *TransferQueue) collectBatches() {
collected, closing = q.collectPendingUntil(done)
// If we've encountered a serious error here, abort immediately;
- // don't process further batches.
+ // don't process further batches. Abort the wait queue so that
+ // we don't deadlock waiting for objects to complete when they
+ // never will.
if err != nil {
+ q.wait.Abort()
break
}
@@ -497,11 +538,6 @@ func (q *TransferQueue) enqueueAndCollectRetriesFor(batch batch) (batch, error)
}
}
- if err != nil && bRes != nil {
- // Avoid a hang if we return early.
- q.wait.Add(-len(bRes.Objects))
- }
-
return next, err
}
}
@@ -521,11 +557,6 @@ func (q *TransferQueue) enqueueAndCollectRetriesFor(batch batch) (batch, error)
// missing in that case, since we don't need to upload
// it.
if o.Missing && len(o.Actions) != 0 {
- // Indicate that we've handled these objects, in
- // this case by ignoring them and aborting
- // early. Failing to do this means we deadlock
- // on this WaitGroup.
- q.wait.Add(-len(bRes.Objects))
return nil, errors.Errorf("Unable to find source for object %v (try running git lfs fetch --all)", o.Oid)
}
}

View File

@ -2,7 +2,7 @@
# https://github.com/git-lfs/git-lfs
%global goipath github.com/git-lfs/git-lfs
Version: 2.8.0
Version: 2.9.0
%gometa
@ -14,27 +14,25 @@ Git extension for versioning large files.}
CONTRIBUTING.md README.md
Name: git-lfs
Release: 4%{?dist}
Release: 1%{?dist}
Summary: Git extension for versioning large files
License: MIT
URL: https://git-lfs.github.io/
Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-v%{version}.tar.gz
# https://github.com/git-lfs/git-lfs/issues/3798
Patch0001: https://github.com/git-lfs/git-lfs/pull/3800.patch
Patch0002: https://github.com/git-lfs/git-lfs/pull/3771.patch
BuildRequires: golang(github.com/git-lfs/gitobj) >= 1.3.1
BuildRequires: golang(github.com/git-lfs/gitobj/errors) >= 1.3.1
BuildRequires: golang(github.com/git-lfs/gitobj) >= 1.4.1
BuildRequires: golang(github.com/git-lfs/gitobj/errors) >= 1.4.1
BuildRequires: golang(github.com/git-lfs/go-netrc/netrc) >= 0-0.1.20180827gite0e9ca4
BuildRequires: golang(github.com/git-lfs/go-ntlm/ntlm)
BuildRequires: golang(github.com/git-lfs/wildmatch) >= 1.0.2
BuildRequires: golang(github.com/kr/pty)
BuildRequires: golang(github.com/git-lfs/wildmatch) >= 1.0.4
BuildRequires: golang(github.com/google/slothfs/cookie)
BuildRequires: golang(github.com/mattn/go-isatty) >= 0.0.4
BuildRequires: golang(github.com/olekukonko/ts)
BuildRequires: golang(github.com/pkg/errors)
BuildRequires: golang(github.com/rubyist/tracerx)
BuildRequires: golang(github.com/spf13/cobra) >= 0.0.3
BuildRequires: golang(golang.org/x/net/http2)
BuildRequires: golang(golang.org/x/sync/semaphore)
# Generate man pages
@ -65,9 +63,6 @@ storing the file contents on a remote server.
%prep
%goprep
%patch0001 -p1
%patch0002 -p1
# Modify Makefile so that it expects binaries where we build them.
sed -i -e 's!\.\./bin/!/%{gobuilddir}/bin/!g' t/Makefile

View File

@ -1 +1 @@
SHA512 (git-lfs-v2.8.0.tar.gz) = e30da595dc2302fef692211da2efe93db9803914603229b46f15199ac9b87fe3d604a0436223d9e47f34b70ea2206ebf69b572003ead8d9f81f036c986281e2c
SHA512 (git-lfs-v2.9.0.tar.gz) = b0df43fd2c73051783359f019f83cd63049bd9fab034fa58c2d026dddb56498530cc13a1468cfc856adbb2483b01dd99a7be53509163b47d7ddcce2e53c3a931