We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
git-lfs aborts (sometimes), fix in progress upstream
This is mostly an FYI.

Starting with `git-lfs@2.7.0` we frequently had `git-lfs` aborting.  In some situations it ran successfully, in others it didn't.  It seemed to depend on what other modules were loaded, but...

Between `git-lfs@2.6.1` and `git-lfs@2.7.0` the Makefile started unconditionally adding a `-extldflags` bit to the `go` command line, setting it to the value of `LDFLAGS`.  If `LDFLAGS` isn't set to anything (our case) then it wasn't given an argument, even though it needs one.  I'm not sure why this doesn't provide an error from the compiler, it seems to be grabbing something out of whatever comes next in memory.

I've changed the Makefile only set `-extldflags` if `LDFLAGS` is defined and made a Pull Request upstream:  https://github.com/git-lfs/git-lfs/pull/3545

Depending what Upstream has to say, perhaps we'll want to patch `git-lfs@2.7.0`, or forbid it, or ...

I'll keep this updated as the `git-lfs` PR progresses.



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `var/spack/repos/builtin/packages/git-lfs/package.py`
Content:
```
1 # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
2 # Spack Project Developers. See the top-level COPYRIGHT file for details.
3 #
4 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
5 
6 from spack import *
7 
8 
9 class GitLfs(MakefilePackage):
10     """Git LFS is a system for managing and versioning large files in
11        association with a Git repository.  Instead of storing the large files
12        within the Git repository as blobs, Git LFS stores special "pointer
13        files" in the repository, while storing the actual file contents on a
14        Git LFS server."""
15 
16     homepage = "https://git-lfs.github.com"
17     url      = "https://github.com/git-lfs/git-lfs/archive/v2.6.1.tar.gz"
18 
19     version('2.7.0', sha256='1c829ddd163be2206a44edb366bd7f6d84c5afae3496687405ca9d2a5f3af07b')
20     version('2.6.1', sha256='e17cd9d4e66d1116be32f7ddc7e660c7f8fabbf510bc01b01ec15a22dd934ead')
21 
22     depends_on('go@1.5:', type='build')
23     depends_on('git@1.8.2:', type='run')
24 
25     parallel = False
26 
27     # Git-lfs does not provide an 'install' target in the Makefile
28     def install(self, spec, prefix):
29         mkdirp(prefix.bin)
30         install(join_path('bin', 'git-lfs'), prefix.bin)
31
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/var/spack/repos/builtin/packages/git-lfs/package.py b/var/spack/repos/builtin/packages/git-lfs/package.py
--- a/var/spack/repos/builtin/packages/git-lfs/package.py
+++ b/var/spack/repos/builtin/packages/git-lfs/package.py
@@ -22,6 +22,8 @@
     depends_on('go@1.5:', type='build')
     depends_on('git@1.8.2:', type='run')
 
+    patch('patches/issue-10702.patch', when='@2.7.0')
+
     parallel = False
 
     # Git-lfs does not provide an 'install' target in the Makefile

{"golden_diff": "diff --git a/var/spack/repos/builtin/packages/git-lfs/package.py b/var/spack/repos/builtin/packages/git-lfs/package.py\n--- a/var/spack/repos/builtin/packages/git-lfs/package.py\n+++ b/var/spack/repos/builtin/packages/git-lfs/package.py\n@@ -22,6 +22,8 @@\n     depends_on('go@1.5:', type='build')\n     depends_on('git@1.8.2:', type='run')\n \n+    patch('patches/issue-10702.patch', when='@2.7.0')\n+\n     parallel = False\n \n     # Git-lfs does not provide an 'install' target in the Makefile\n", "issue": "git-lfs aborts (sometimes), fix in progress upstream\nThis is mostly an FYI.\r\n\r\nStarting with `git-lfs@2.7.0` we frequently had `git-lfs` aborting.  In some situations it ran successfully, in others it didn't.  It seemed to depend on what other modules were loaded, but...\r\n\r\nBetween `git-lfs@2.6.1` and `git-lfs@2.7.0` the Makefile started unconditionally adding a `-extldflags` bit to the `go` command line, setting it to the value of `LDFLAGS`.  If `LDFLAGS` isn't set to anything (our case) then it wasn't given an argument, even though it needs one.  I'm not sure why this doesn't provide an error from the compiler, it seems to be grabbing something out of whatever comes next in memory.\r\n\r\nI've changed the Makefile only set `-extldflags` if `LDFLAGS` is defined and made a Pull Request upstream:  https://github.com/git-lfs/git-lfs/pull/3545\r\n\r\nDepending what Upstream has to say, perhaps we'll want to patch `git-lfs@2.7.0`, or forbid it, or ...\r\n\r\nI'll keep this updated as the `git-lfs` PR progresses.\r\n\r\n\n", "before_files": [{"content": "# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other\n# Spack Project Developers. See the top-level COPYRIGHT file for details.\n#\n# SPDX-License-Identifier: (Apache-2.0 OR MIT)\n\nfrom spack import *\n\n\nclass GitLfs(MakefilePackage):\n    \"\"\"Git LFS is a system for managing and versioning large files in\n       association with a Git repository.  Instead of storing the large files\n       within the Git repository as blobs, Git LFS stores special \"pointer\n       files\" in the repository, while storing the actual file contents on a\n       Git LFS server.\"\"\"\n\n    homepage = \"https://git-lfs.github.com\"\n    url      = \"https://github.com/git-lfs/git-lfs/archive/v2.6.1.tar.gz\"\n\n    version('2.7.0', sha256='1c829ddd163be2206a44edb366bd7f6d84c5afae3496687405ca9d2a5f3af07b')\n    version('2.6.1', sha256='e17cd9d4e66d1116be32f7ddc7e660c7f8fabbf510bc01b01ec15a22dd934ead')\n\n    depends_on('go@1.5:', type='build')\n    depends_on('git@1.8.2:', type='run')\n\n    parallel = False\n\n    # Git-lfs does not provide an 'install' target in the Makefile\n    def install(self, spec, prefix):\n        mkdirp(prefix.bin)\n        install(join_path('bin', 'git-lfs'), prefix.bin)\n", "path": "var/spack/repos/builtin/packages/git-lfs/package.py"}], "after_files": [{"content": "# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other\n# Spack Project Developers. See the top-level COPYRIGHT file for details.\n#\n# SPDX-License-Identifier: (Apache-2.0 OR MIT)\n\nfrom spack import *\n\n\nclass GitLfs(MakefilePackage):\n    \"\"\"Git LFS is a system for managing and versioning large files in\n       association with a Git repository.  Instead of storing the large files\n       within the Git repository as blobs, Git LFS stores special \"pointer\n       files\" in the repository, while storing the actual file contents on a\n       Git LFS server.\"\"\"\n\n    homepage = \"https://git-lfs.github.com\"\n    url      = \"https://github.com/git-lfs/git-lfs/archive/v2.6.1.tar.gz\"\n\n    version('2.7.0', sha256='1c829ddd163be2206a44edb366bd7f6d84c5afae3496687405ca9d2a5f3af07b')\n    version('2.6.1', sha256='e17cd9d4e66d1116be32f7ddc7e660c7f8fabbf510bc01b01ec15a22dd934ead')\n\n    depends_on('go@1.5:', type='build')\n    depends_on('git@1.8.2:', type='run')\n\n    patch('patches/issue-10702.patch', when='@2.7.0')\n\n    parallel = False\n\n    # Git-lfs does not provide an 'install' target in the Makefile\n    def install(self, spec, prefix):\n        mkdirp(prefix.bin)\n        install(join_path('bin', 'git-lfs'), prefix.bin)\n", "path": "var/spack/repos/builtin/packages/git-lfs/package.py"}]}