internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: spack/spack

Issue:
Vim does not use spack's ncurses

``` bash
$ spack install vim
==> Installing vim
==> ncurses is already installed in spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/ncurses-6.0-75hnzrecoib5eqdvfchl6n2jgcxc6dgo
==> Using cached archive: spack/var/spack/cache/vim/vim-8.0.0503.tar.gz
==> Staging archive: spack/var/spack/stage/vim-8.0.0503-55us7ijakx452ll3suegl6ocx7nzcmfi/v8.0.0503.tar.gz
==> Created stage in spack/var/spack/stage/vim-8.0.0503-55us7ijakx452ll3suegl6ocx7nzcmfi
==> Ran patch() for vim
==> Building vim [AutotoolsPackage]
==> Executing phase : 'autoreconf'
==> Executing phase : 'configure'
==> Error: ProcessError: Command exited with status 1:
    'spack/var/spack/stage/vim-8.0.0503-55us7ijakx452ll3suegl6ocx7nzcmfi/vim-8.0.0503/configure' '--prefix=spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/vim-8.0.0503-55us7ijakx452ll3suegl6ocx7nzcmfi' '--enable-fail-if-missing' '--with-features=normal' '--enable-pythoninterp=no' '--enable-rubyinterp=no' '--enable-luainterp=no' '--enable-perlinterp=no' '--enable-gui=no' '--without-x'
spack/lib/spack/spack/build_systems/autotools.py:266, in configure:
     258      def configure(self, spec, prefix):
     259          """Runs configure with the arguments specified in
     260          :py:meth:`~.AutotoolsPackage.configure_args`
     261          and an appropriately set prefix.
     262          """
     263          options = ['--prefix={0}'.format(prefix)] + self.configure_args()
     264
     265          with working_dir(self.build_directory, create=True):
  >> 266              inspect.getmodule(self).configure(*options)
```

spack-build.out
``` bash
...
checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -ltinfo... no
checking for tgetent in -lncurses... no
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
```

Vim does not build on Centos 7 unless ```ncurses-devel``` or equevalent package is installed because the vim's configure will search for libncurses, but not libncursesw. 

The fix is to explicitly point vim's configure to ncuresew using ```--with-tlib=ncursesw```


Discussion:
Feel free to contribute a PR!

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/vim/package.py b/var/spack/repos/builtin/packages/vim/package.py
--- a/var/spack/repos/builtin/packages/vim/package.py
+++ b/var/spack/repos/builtin/packages/vim/package.py
@@ -90,6 +90,8 @@ def configure_args(self):
 
         configure_args = ["--enable-fail-if-missing"]
 
+        configure_args.append("--with-tlib=ncursesw")
+
         configure_args.append("--with-features=" + feature_set)
 
         if '+python' in spec:


Test patch:
Repository: spack/spack

Issue:
Cloning git submodule with depth=1 leads to "no such remote ref" error
When cloning git submodule inside spack with depth=1 (now default), one gets an error like:
```
error: no such remote ref 91fdf75b82b55b25dd9e79cc85e32e6fdb9e4f53
Fetched in submodule path 'cinch', but it did not contain 91fdf75b82b55b25dd9e79cc85e32e6fdb9e4f53. Direct fetching of that commit failed.
```
when the required hash in the submodule isn't the current HEAD of master.


Discussion:
Could be related to #3779. Can you try undoing that PR and see if it fixes the problem? What package does this occur for?
I found this when trying to remove the hack for #3779 in `flecsi` (see #3780).

Resolving patch:
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -686,20 +686,11 @@ def fetch(self):
 
         # Init submodules if the user asked for them.
         if self.submodules:
-            # only git 1.8.4 and later have --depth option
-            if self.git_version < ver('1.8.4'):
-                if spack.debug:
-                    self.git('submodule', 'update', '--init', '--recursive')
-                else:
-                    self.git('submodule', '--quiet', 'update', '--init',
-                             '--recursive')
+            if spack.debug:
+                self.git('submodule', 'update', '--init', '--recursive')
             else:
-                if spack.debug:
-                    self.git('submodule', 'update', '--init', '--recursive',
-                             '--depth=1')
-                else:
-                    self.git('submodule', '--quiet', 'update', '--init',
-                             '--recursive', '--depth=1')
+                self.git('submodule', '--quiet', 'update', '--init',
+                         '--recursive')
 
     def archive(self, destination):
         super(GitFetchStrategy, self).archive(destination, exclude='.git')


Test patch:
Repository: spack/spack

Issue:
"spack uninstall --all" fails on python3
On python3:
```
$ spack uninstall --all
...
==> Do you want to proceed? [y/N] Traceback (most recent call last):
  File "/home/christoph/spack/bin/spack", line 220, in <module>
    main(sys.argv)
  File "/home/christoph/spack/bin/spack", line 216, in main
    _main(args, unknown)
  File "/home/christoph/spack/bin/spack", line 183, in _main
    return_val = command(parser, args)
  File "/home/christoph/spack/lib/spack/spack/cmd/uninstall.py", line 213, in uninstall
    answer = tty.get_yes_or_no('Do you want to proceed?', default=False)
  File "/home/christoph/spack/lib/spack/llnl/util/tty/__init__.py", line 200, in get_yes_or_no
    ans = raw_input().lower()
NameError: name 'raw_input' is not defined
```
while on python2.7, it works as expected:
```
$ python2.7 `which spack` uninstall --all
...
==> Do you want to proceed? [y/N]
```



Discussion:

Resolving patch:
diff --git a/lib/spack/llnl/util/tty/__init__.py b/lib/spack/llnl/util/tty/__init__.py
--- a/lib/spack/llnl/util/tty/__init__.py
+++ b/lib/spack/llnl/util/tty/__init__.py
@@ -30,6 +30,7 @@
 import struct
 import traceback
 from six import StringIO
+from six.moves import input
 
 from llnl.util.tty.color import *
 
@@ -164,7 +165,7 @@ def get_number(prompt, **kwargs):
     number = None
     while number is None:
         msg(prompt, newline=False)
-        ans = raw_input()
+        ans = input()
         if ans == str(abort):
             return None
 
@@ -197,7 +198,7 @@ def get_yes_or_no(prompt, **kwargs):
     result = None
     while result is None:
         msg(prompt, newline=False)
-        ans = raw_input().lower()
+        ans = input().lower()
         if not ans:
             result = default_value
             if result is None:
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1187,7 +1187,7 @@ def build_process(input_stream):
             # otherwise it should not have passed us the copy of the stream.
             # Thus, we are free to work with the the copy (input_stream)
             # however we want. For example, we might want to call functions
-            # (e.g. raw_input()) that implicitly read from whatever stream is
+            # (e.g. input()) that implicitly read from whatever stream is
             # assigned to sys.stdin. Since we want them to work with the
             # original input stream, we are making the following assignment:
             sys.stdin = input_stream


Test patch:
Repository: spack/spack

Issue:
Uninstalled packages in the database
I recently tried to uninstall all of my installed packages, but ran into an error message (possibly because I have packages installed from other branches and have been updating my branch). I manually deleted all of my Spack installations and tried running `spack reindex`, but everything is still there. `spack install` properly reinstalls packages, but commands like `spack find` and `spack activate` still point to the old installations. I thought `spack reindex` was supposed to fix this?


Discussion:
I think this is from #1167: it updated reindex to use old DB records when available but doesn't check if they are installed. I'll try to get a PR out for this soon.

Resolving patch:
diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py
--- a/lib/spack/spack/database.py
+++ b/lib/spack/spack/database.py
@@ -473,13 +473,18 @@ def _read_suppress_error():
                         layout = spack.store.layout
                         if entry.spec.external:
                             layout = None
-                        kwargs = {
-                            'spec': entry.spec,
-                            'directory_layout': layout,
-                            'explicit': entry.explicit
-                        }
-                        self._add(**kwargs)
-                        processed_specs.add(entry.spec)
+                            install_check = True
+                        else:
+                            install_check = layout.check_installed(entry.spec)
+
+                        if install_check:
+                            kwargs = {
+                                'spec': entry.spec,
+                                'directory_layout': layout,
+                                'explicit': entry.explicit
+                            }
+                            self._add(**kwargs)
+                            processed_specs.add(entry.spec)
                     except Exception as e:
                         # Something went wrong, so the spec was not restored
                         # from old data


Test patch:
Repository: spack/spack

Issue:
Can Spack NOT echo "Run patch()..." when no patches are defined
Spack appears to echo "Ran patch() for foobar" even if no patch is implemented. This was puzzling me a bit because I hadn't defined any patches for a package I was writing.

Can Spack just NOT echo this line if it is NOT applying any patches?




Discussion:
Technically, `patch()` is always defined in `lib/spack/spack/package.py`. It doesn't do anything by default, but can be overridden. So it may be hard to tell whether or not `patch()` has been implemented. But I agree that it can be confusing, so if we can get it to not print that line it would be good.

Resolving patch:
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -58,6 +58,7 @@
 import spack.repository
 import spack.url
 import spack.util.web
+import spack.multimethod
 
 from llnl.util.filesystem import *
 from llnl.util.lang import *
@@ -939,10 +940,6 @@ def do_stage(self, mirror_only=False):
         self.stage.expand_archive()
         self.stage.chdir_to_source()
 
-    def patch(self):
-        """Default patch implementation is a no-op."""
-        pass
-
     def do_patch(self):
         """Calls do_stage(), then applied patches to the expanded tarball if they
            haven't been applied already."""
@@ -1003,6 +1000,10 @@ def do_patch(self):
                 self.patch()
                 tty.msg("Ran patch() for %s" % self.name)
                 patched = True
+            except spack.multimethod.NoSuchMethodError:
+                # We are running a multimethod without a default case.
+                # If there's no default it means we don't need to patch.
+                tty.msg("No patches needed for %s" % self.name)
             except:
                 tty.msg("patch() function failed for %s" % self.name)
                 touch(bad_file)


Test patch:
Repository: spack/spack

Issue:
Add compatibility system for python 2/3
Add zip and zip_longest to this compatibility system to fix a bug
with spack info


Discussion:
> ... to fix a bug with spack info

What bug?
Also, if it relates to Python 2/3 compatibility, you should probably just use `six`. It's already included in our external packages.
Ah, I see the error:
```
$ python3 $(which spack) info hdf
Package:    hdf
Homepage:   https://www.hdfgroup.org/products/hdf4/

Safe versions:  
    4.2.12    https://www.hdfgroup.org/ftp/HDF/releases/HDF4.2.12/src/hdf-4.2.12.tar.gz
    4.2.11    https://www.hdfgroup.org/ftp/HDF/releases/HDF4.2.11/src/hdf-4.2.11.tar.gz

Variants:
    Name [Default]    Allowed values    Description

==> Error: module 'itertools' has no attribute 'izip_longest'
```
Hahha, oops, I totally forgot to define the error! That's the one.

for me it was `spack info autogen`.

If there's a better way to fix this, I'm happy to use that.

Resolving patch:
diff --git a/lib/spack/spack/cmd/info.py b/lib/spack/spack/cmd/info.py
--- a/lib/spack/spack/cmd/info.py
+++ b/lib/spack/spack/cmd/info.py
@@ -25,7 +25,7 @@
 from __future__ import print_function
 
 import textwrap
-import itertools
+from six.moves import zip_longest
 from llnl.util.tty.colify import *
 import spack
 import spack.fetch_strategy as fs
@@ -119,7 +119,7 @@ def lines(self):
                     v.description,
                     width=self.column_widths[2]
                 )
-                for t in itertools.izip_longest(
+                for t in zip_longest(
                         name, allowed, description, fillvalue=''
                 ):
                     yield "    " + self.fmt % t


Test patch:
Repository: spack/spack

Issue:
Checksum Error: libaio
```bash
$ spack install libaio
==> Installing libaio
==> Already downloaded .../spack/var/spack/stage/libaio-0.3.110-1-x73kmwi7rzgszlgz2xngvtxlo3sa7swj/libaio-0.3.110-1.tar.gz
==> Error: ChecksumError: md5 checksum failed for .../spack/var/spack/stage/libaio-0.3.110-1-x73kmwi7rzgszlgz2xngvtxlo3sa7swj/libaio-0.3.110-1.tar.gz
    Expected eb6b1b435afadb5b80c5dd80984249f6 but got f7408735589b6365d089ee3cc69abd83
```


Discussion:
If you clear your repository and try fetching again, you'll get even more useful output:
```
$ spack fetch libaio
==> Fetching https://git.fedorahosted.org/cgit/libaio.git/snapshot/libaio-0.3.110-1.tar.gz
######################################################################## 100.0%
==> Warning: The contents of 
  the archive
   look like HTML.
  The checksum will likely be bad.  If it is, you can use
  'spack clean <package>' to remove the bad archive, then
  fix your internet gateway issue and install again.
==> Error: md5 checksum failed for /Users/Adam/spack/var/spack/stage/libaio-0.3.110-1-t7nbakuufbh5t7crtcr7dymp2z3u4bch/libaio-0.3.110-1.tar.gz
Expected eb6b1b435afadb5b80c5dd80984249f6 but got b20e0403f8054796a1c474e146b146c4
```
The checksum didn't change, the package is just no longer available for download. If you go to the project homepage: https://git.fedorahosted.org/cgit/libaio.git

> fedorahosted.org was retired on March 1st, 2017. If you are viewing this page, odds are it's after that date and you have been redirected here by attempting to go to some project on fedorahosted.org. If you are a user of a project formerly hosted at fedorahosted.org, please search for the new home the project you are interested in likely has. If you are a maintainer of a project formerly hosted at fedorahosted.org and need your data to migrate, see below.

Duplicate of #3851 which first reported this problem. If you can find a new download URL, feel free to fix this.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/libaio/package.py b/var/spack/repos/builtin/packages/libaio/package.py
--- a/var/spack/repos/builtin/packages/libaio/package.py
+++ b/var/spack/repos/builtin/packages/libaio/package.py
@@ -28,10 +28,10 @@
 class Libaio(Package):
     """This is the linux native Asynchronous I/O interface library."""
 
-    homepage = "https://git.fedorahosted.org/cgit/libaio.git"
-    url      = "https://git.fedorahosted.org/cgit/libaio.git/snapshot/libaio-0.3.110-1.tar.gz"
+    homepage = "http://lse.sourceforge.net/io/aio.html"
+    url      = "https://ftp.de.debian.org/debian/pool/main/liba/libaio/libaio_0.3.110.orig.tar.gz"
 
-    version('0.3.110-1', 'eb6b1b435afadb5b80c5dd80984249f6')
+    version('0.3.110', '2a35602e43778383e2f4907a4ca39ab8')
 
     def install(self, spec, prefix):
         # libaio is not supported on OS X


Test patch:
Repository: spack/spack

Issue:
spack cannot fetch xmlto and libaio
xmlto and libaio come from fedorahosted, which was shut down recently (see #3443).

``` bash
$ spack -k fetch xmlto
==> Warning: You asked for --insecure. Will NOT check SSL certificates.
==> Fetching https://fedorahosted.org/releases/x/m/xmlto/xmlto-0.0.28.tar.gz
######################################################################## 100.0%
==> Warning: The contents of
  the archive
   look like HTML.
  The checksum will likely be bad.  If it is, you can use
  'spack clean <package>' to remove the bad archive, then
  fix your internet gateway issue and install again.
==> Error: md5 checksum failed for spack/var/spack/stage/xmlto-0.0.28-ufblxyjfmyray7qizbwsp35yjvtdbcgt/xmlto-0.0.28.tar.gz
Expected a1fefad9d83499a15576768f60f847c6 but got 7668bec561b55df947064376ecbb3efc
$ spack -k fetch libaio
==> Warning: You asked for --insecure. Will NOT check SSL certificates.
==> Fetching https://git.fedorahosted.org/cgit/libaio.git/snapshot/libaio-0.3.110-1.tar.gz
######################################################################## 100.0%
==> Warning: The contents of
  the archive
   look like HTML.
  The checksum will likely be bad.  If it is, you can use
  'spack clean <package>' to remove the bad archive, then
  fix your internet gateway issue and install again.
==> Error: md5 checksum failed for spack/var/spack/stage/libaio-0.3.110-1-5jilczsccwwmsldt2gx5c2xse7g5zvlk/libaio-0.3.110-1.tar.gz
Expected eb6b1b435afadb5b80c5dd80984249f6 but got 4e3d06aa49b80ef4eed351b40f564adf
```


Discussion:
Feel free to update the URLs if you can find where they moved to.
xmlto migrated to https://pagure.io/xmlto, will provide a PR

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/xmlto/package.py b/var/spack/repos/builtin/packages/xmlto/package.py
--- a/var/spack/repos/builtin/packages/xmlto/package.py
+++ b/var/spack/repos/builtin/packages/xmlto/package.py
@@ -31,8 +31,8 @@ class Xmlto(AutotoolsPackage):
     without remembering many long options and searching for the syntax of the
     backends."""
 
-    homepage = "http://cyberelk.net/tim/software/xmlto/"
-    url      = "https://fedorahosted.org/releases/x/m/xmlto/xmlto-0.0.28.tar.gz"
+    homepage = "https://pagure.io/xmlto"
+    url      = "https://releases.pagure.org/xmlto/xmlto-0.0.28.tar.gz"
 
     version('0.0.28', 'a1fefad9d83499a15576768f60f847c6')
 


Test patch:
Repository: spack/spack

Issue:
Weird autotools package issue
Hey folks, I'm attempting to add a new package, and I'm currently stuck on the autoreconf step. When this step executes, I get the following output:

```
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
aclocal: warning: couldn't open directory 'm4': No such file or directory
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /home/matthew/Software/NCSA/Vertical/singularity-test/spack/opt/spack/linux-arch-x86_64/gcc-7.1.1/autoconf-2.69-5urbex6c4rhihuhwpue32bexzwe6yosk/bin/autoconf --force
configure.ac:35: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:39: error: possibly undefined macro: AC_ENABLE_SHARED
autoreconf: /home/matthew/Software/NCSA/Vertical/singularity-test/spack/opt/spack/linux-arch-x86_64/gcc-7.1.1/autoconf-2.69-5urbex6c4rhihuhwpue32bexzwe6yosk/bin/autoconf failed with exit status: 1
```

Google searching for this error message gives only answers saying that `libtool`, `autoconf`, and `automake` need to be installed. However I have already defined these packages as dependencies to no effect.

Any suggestions on how to fix this?


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/libtool/package.py b/var/spack/repos/builtin/packages/libtool/package.py
--- a/var/spack/repos/builtin/packages/libtool/package.py
+++ b/var/spack/repos/builtin/packages/libtool/package.py
@@ -41,6 +41,10 @@ class Libtool(AutotoolsPackage):
     def _make_executable(self, name):
         return Executable(join_path(self.prefix.bin, name))
 
+    def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
+        spack_env.append_path('ACLOCAL_PATH',
+                              join_path(self.prefix.share, 'aclocal'))
+
     def setup_dependent_package(self, module, dependent_spec):
         # Automake is very likely to be a build dependency,
         # so we add the tools it provides to the dependent module
diff --git a/var/spack/repos/builtin/packages/pkg-config/package.py b/var/spack/repos/builtin/packages/pkg-config/package.py
--- a/var/spack/repos/builtin/packages/pkg-config/package.py
+++ b/var/spack/repos/builtin/packages/pkg-config/package.py
@@ -51,6 +51,8 @@ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
         files."""
         spack_env.append_path('PKG_CONFIG_PATH', '/usr/lib64/pkgconfig')
         spack_env.append_path('PKG_CONFIG_PATH', '/usr/local/lib64/pkgconfig')
+        spack_env.append_path('ACLOCAL_PATH',
+                              join_path(self.prefix.share, 'aclocal'))
 
     def configure_args(self):
         config_args = ['--enable-shared']


Test patch:
Repository: spack/spack

Issue:
metis 4.0.3 doesn't install on macOS 10.11.6 with appleclang 7.0.3
A gist of the installation log is at https://gist.github.com/goxberry/b9ca39f4d7c5cd6b0905aaaa42f53746

If I had to guess, the error at the end of the log re: the RPATH option `-rpath=$STUFF` is the problem; IIRC, that syntax works on GCC, but not with LLVM/clang. Replacing `-rpath=` with `-rpath,` (that is, replace the equals sign with a comma) should work for both GCC and LLVM/clang compilers.


Discussion:
Ah, found the problem in the metis package. Submitting a fix shortly.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/metis/package.py b/var/spack/repos/builtin/packages/metis/package.py
--- a/var/spack/repos/builtin/packages/metis/package.py
+++ b/var/spack/repos/builtin/packages/metis/package.py
@@ -135,7 +135,8 @@ def install(self, spec, prefix):
 
         # Set up and run tests on installation
         ccompile('-I%s' % prefix.include, '-L%s' % prefix.lib,
-                 '-Wl,-rpath=%s' % (prefix.lib if '+shared' in spec else ''),
+                 self.compiler.cc_rpath_arg +
+                 '%s' % (prefix.lib if '+shared' in spec else ''),
                  join_path('Programs', 'io.o'), join_path('Test', 'mtest.c'),
                  '-o', '%s/mtest' % prefix.bin, '-lmetis', '-lm')
 


Test patch: