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

Issue:
Replace /bin/bash with /usr/bin/env bash
Currently `conda` hardcodes `#!/bin/bash`. If instead `#!/usr/bin/env bash` would be used, then the version of the current environment would be used.

I'm attempting to package `conda` at the moment for an OS where `#!/bin/bash` is unavailable, but `#!/usr/bin/env bash` does work.

The same by the way applies to some of the packages offered via `conda`.

Edit:
I can understand if such change wouldn't be made since there might be distributions where exactly that option isn't available.



Discussion:
What exactly do you mean when say "`conda` hardcodes `#!/bin/bash`?  Do you mean the Miniconda installer?

Installing packages on a system where `#!/bin/bash` isn't available but `#!/usr/bin/env bash` is doesn't work because of:
https://github.com/conda/conda/blob/master/conda/install.py#L339

The same applies for many of the packages offered by Anaconda as well as many of the recipes at
https://github.com/conda/conda-recipes/search?utf8=%E2%9C%93&q=bash

https://github.com/conda/conda/blob/master/conda/install.py#L339 is only concerning the pre/post link scripts, which are not often used.  I've never come across a Unix system, which does not have `/bin/bash` installed.  I think it is safer to assume that `/bin/bash` exists than `/usr/bin/env`.  What system are you having this problem with?  And where is `bash` installed?  The easiest fix would be to create a link in `/bin/bash` to the location where bash is located on that system, I would say.  Do you have similar problems with other software of this system?

I was using NixOS which puts all software in a store on a not so standard place.
When packaging software for Nix it is common to replace direct calls to /bin/bash since it doesn't exist on this system. `/usr/bin/env` is however available and is more portable.


Resolving patch:
diff --git a/conda/core/link.py b/conda/core/link.py
--- a/conda/core/link.py
+++ b/conda/core/link.py
@@ -691,7 +691,7 @@ def run_script(prefix, dist, action='post-link', env_prefix=None):
             log.info("failed to run %s for %s due to COMSPEC KeyError", action, dist)
             return False
     else:
-        shell_path = '/bin/sh' if 'bsd' in sys.platform else '/bin/bash'
+        shell_path = 'sh' if 'bsd' in sys.platform else 'bash'
         command_args = [shell_path, "-x", path]
 
     env['ROOT_PREFIX'] = context.root_prefix


Test patch:
Repository: conda/conda

Issue:
conda config --describe reports elements types as str for everything



Discussion:

Resolving patch:
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py
--- a/conda/cli/main_config.py
+++ b/conda/cli/main_config.py
@@ -279,22 +279,16 @@ def execute_config(args, parser):
                              sort_keys=True, indent=2, separators=(',', ': '),
                              cls=EntityEncoder))
         else:
-            def clean_element_type(element_types):
-                _types = set()
-                for et in element_types:
-                    _types.add('str') if isinstance(et, string_types) else _types.add('%s' % et)
-                return tuple(sorted(_types))
-
             for name in paramater_names:
                 details = context.describe_parameter(name)
                 aliases = details['aliases']
                 string_delimiter = details.get('string_delimiter')
                 element_types = details['element_types']
                 if details['parameter_type'] == 'primitive':
-                    print("%s (%s)" % (name, ', '.join(clean_element_type(element_types))))
+                    print("%s (%s)" % (name, ', '.join(sorted(set(et for et in element_types)))))
                 else:
                     print("%s (%s: %s)" % (name, details['parameter_type'],
-                                           ', '.join(clean_element_type(element_types))))
+                                           ', '.join(sorted(set(et for et in element_types)))))
                 def_str = '  default: %s' % json.dumps(details['default_value'], indent=2,
                                                        separators=(',', ': '),
                                                        cls=EntityEncoder)


Test patch:
Repository: conda/conda

Issue:
conda env export under python2 is ug
```
$ python2 -m conda_env export -p /conda
name: null
channels:
- !!python/unicode
  'file:///Users/kfranz/.conda/conda-bld'
- !!python/unicode
  'file:///conda/conda-bld'
- !!python/unicode
  'bkreider'
- !!python/unicode
  'conda-canary'
- !!python/unicode
  'conda-forge'
- !!python/unicode
  'defaults'
dependencies:
- !!python/unicode
  'wget=1.15=2'
- !!python/unicode
  'conda=4.3.0=py27_0'
- !!python/unicode
  'conda-env=2.6.0=0'
- !!python/unicode
  'filelock=2.0.6=py27_0'
- !!python/unicode
  'boltons=16.3.1=py27_0'
- !!python/unicode
  'ca-certificates=2016.8.31=0'
- !!python/unicode
  'certifi=2016.8.31=py27_0'
- !!python/unicode
  'functools32=3.2.3.2=py27_1'
...
```


Discussion:

Resolving patch:
diff --git a/conda_env/yaml.py b/conda_env/yaml.py
--- a/conda_env/yaml.py
+++ b/conda_env/yaml.py
@@ -6,6 +6,7 @@
 from __future__ import absolute_import, print_function
 from collections import OrderedDict
 
+from conda.common.compat import PY2
 from conda.common.yaml import get_yaml
 yaml = get_yaml()
 
@@ -24,6 +25,12 @@ def represent_ordereddict(dumper, data):
 
 yaml.add_representer(OrderedDict, represent_ordereddict)
 
+if PY2:
+    def represent_unicode(self, data):
+        return self.represent_str(data.encode('utf-8'))
+
+    yaml.add_representer(unicode, represent_unicode)  # NOQA
+
 dump = yaml.dump
 load = yaml.load
 dict = OrderedDict


Test patch:
Repository: conda/conda

Issue:
conda env export deprecated?
Got a rather strange warning earlier that seemed to imply `conda env export` is going to stop working. I hope I'm just misreading this and/or this warning is talking about something else.

FWIW I have found `conda env export` really useful so as to export an environment file to `stdout` that I can then include in issues. This way people can reproduce the issue I'm running into.

```bash
$ conda info
Current conda install:

               platform : linux-64
          conda version : 4.2.13
       conda is private : False
      conda-env version : 4.2.13
    conda-build version : 2.1.2
         python version : 3.5.3.final.0
       requests version : 2.12.5
       root environment : /opt/conda  (writable)
    default environment : /opt/conda/envs/test
       envs directories : /opt/conda/envs
          package cache : /opt/conda/pkgs
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /root/.condarc
           offline mode : False

$ conda env export
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
...
```


Discussion:
It looks like a warning from pip, not from conda.  Conda is probably not redirecting pip's stderr.
Just a quick reply---yes, that's a pip warning. We'll have to make sure we handle that properly moving forward, but conda env behavior will not be changing because of it.
Phew! 😌 Thanks for clarifying.
This gets rid of the warning:

    PIP_FORMAT=legacy conda env export 
Not yet it isn't!
It would still be a good idea to explicitly specify the export format when calling pip. That will get rid of the warning, and you'll never have to worry about the changing default in the future.
Oh, I get it.  To be added to conda-env.
xref https://github.com/conda/conda/issues/5212

Resolving patch:
diff --git a/conda_env/pip_util.py b/conda_env/pip_util.py
--- a/conda_env/pip_util.py
+++ b/conda_env/pip_util.py
@@ -4,6 +4,8 @@
 NOTE: This modules used to in conda, as conda/pip.py
 """
 from __future__ import absolute_import, print_function
+
+import os
 from os.path import isfile, join
 import re
 import subprocess
@@ -52,9 +54,11 @@ def installed(prefix, output=True):
     if args is None:
         return
     args.append('list')
+    env = os.environ.copy()
+    env[str('PIP_FORMAT')] = str('legacy')
     try:
         pipinst = subprocess.check_output(
-            args, universal_newlines=True
+            args, universal_newlines=True, env=env,
         ).splitlines()
     except Exception:
         # Any error should just be ignored


Test patch:
Repository: conda/conda

Issue:
conda-env appears to lack support for path-based environments
I am trying to use `conda env` with AEN where all the conda environments are path-based (not name-based), however I cannot figure out how to do `conda env attach` or `conda env export` since, so far as I can tell, conda-env only works with name-based conda environments.


Discussion:

Resolving patch:
diff --git a/conda_env/__main__.py b/conda_env/__main__.py
new file mode 100644
--- /dev/null
+++ b/conda_env/__main__.py
@@ -0,0 +1,5 @@
+import sys
+
+from .cli.main import main
+
+sys.exit(main())
diff --git a/conda_env/cli/main_export.py b/conda_env/cli/main_export.py
--- a/conda_env/cli/main_export.py
+++ b/conda_env/cli/main_export.py
@@ -1,13 +1,15 @@
 from __future__ import absolute_import, print_function
 
+from argparse import RawDescriptionHelpFormatter
 import os
 import textwrap
-from argparse import RawDescriptionHelpFormatter
-from conda import config
-from ..env import from_environment
+
+from conda.cli.common import add_parser_prefix
 # conda env import
-from conda_env.cli.common import get_prefix
+from .common import get_prefix
+from ..env import from_environment
 from ..exceptions import CondaEnvException
+
 description = """
 Export a given environment
 """
@@ -39,13 +41,7 @@ def configure_parser(sub_parsers):
         action="store_true",
         help="Do not include .condarc channels",
     )
-
-    p.add_argument(
-        '-n', '--name',
-        action='store',
-        help='name of environment (in %s)' % os.pathsep.join(config.envs_dirs),
-        default=None,
-    )
+    add_parser_prefix(p)
 
     p.add_argument(
         '-f', '--file',
@@ -73,7 +69,7 @@ def configure_parser(sub_parsers):
 
 # TODO Make this aware of channels that were used to install packages
 def execute(args, parser):
-    if not args.name:
+    if not (args.name or args.prefix):
         # Note, this is a hack fofr get_prefix that assumes argparse results
         # TODO Refactor common.get_prefix
         name = os.environ.get('CONDA_DEFAULT_ENV', False)


Test patch:
Repository: conda/conda

Issue:
Creating a virtual environment starting with '.' (dot/period)
Hi,
Is there any way to create a virtual environment that starts with a '.' (dot/period)? I am running a program that searches for virtual python environments in a specific dot-prefixed folder name. The developers for that software use `virtualenv`  for their environment, but I would like to keep using conda and was wondering if there is a workaround for this.

Cheers



Discussion:
What error do you get? I didn't know there was a restriction. 
Ah, it looks like we do indeed restrict it.

```
kfranz@0283:~/continuum/conda *test-requests ❯ python -m conda create -n .someenv

CondaValueError: environment name cannot start with '.': .someenv
```
I've traced that restriction down to b9f5528c1399612f8513b81eb432af0e3fd8c186.  I also don't understand the technical reason it was implemented.  The commit author also didn't remember much context.

Resolving patch:
diff --git a/conda/cli/install.py b/conda/cli/install.py
--- a/conda/cli/install.py
+++ b/conda/cli/install.py
@@ -35,8 +35,6 @@
 def check_prefix(prefix, json=False):
     name = basename(prefix)
     error = None
-    if name.startswith('.'):
-        error = "environment name cannot start with '.': %s" % name
     if name == ROOT_ENV_NAME:
         error = "'%s' is a reserved environment name" % name
     if exists(prefix):
diff --git a/conda/misc.py b/conda/misc.py
--- a/conda/misc.py
+++ b/conda/misc.py
@@ -12,14 +12,15 @@
 import sys
 
 from ._vendor.auxlib.path import expand
+from .base.constants import PREFIX_MAGIC_FILE
 from .base.context import context
 from .common.compat import iteritems, iterkeys, itervalues, on_win, open
 from .common.path import url_to_path, win_path_ok
 from .common.url import is_url, join_url, path_to_url, unquote
-from .core.index import get_index, _supplement_index_with_cache
+from .core.index import _supplement_index_with_cache, get_index
 from .core.linked_data import linked_data
 from .core.package_cache import PackageCache, ProgressiveFetchExtract
-from .exceptions import FileNotFoundError, ParseError, PackageNotFoundError
+from .exceptions import FileNotFoundError, PackageNotFoundError, ParseError
 from .gateways.disk.delete import rm_rf
 from .gateways.disk.link import islink
 from .instructions import LINK, UNLINK
@@ -329,10 +330,8 @@ def list_prefixes():
         if not isdir(envs_dir):
             continue
         for dn in sorted(os.listdir(envs_dir)):
-            if dn.startswith('.'):
-                continue
             prefix = join(envs_dir, dn)
-            if isdir(prefix):
+            if isdir(prefix) and isfile(join(prefix, PREFIX_MAGIC_FILE)):
                 prefix = join(envs_dir, dn)
                 yield prefix
 


Test patch:
Repository: conda/conda

Issue:
`conda package -w` is case dependent on Windows
It should be case-insensitive, because windows filesystem is case insensitive.
E.g., when I run from the environment root:

`conda package -w Lib\site-packages\win32\win32file.pyd`

Ir finds the package, but if I run

`conda package -w lib\site-packages\win32\win32file.pyd`

it will report nothing.



Discussion:
I think the problem is the function [`which_path`](https://github.com/conda/conda/blob/master/conda/misc.py#L149) uses string comparisons to test equality against file paths. I think that function should use [`os.path.normpath()`](https://docs.python.org/2/library/os.path.html#os.path.normcase) on all paths to make the path components all lower-case so string comparison works. In fact, a nice path equality utility function that could be used throughout conda would be:

``` python
from os.path import normpath, abspath

def paths_equal(path1, path2):
    return normpath(abspath(path1)) == normpath(abspath(path2))
```


Resolving patch:
diff --git a/conda/cli/main_package.py b/conda/cli/main_package.py
--- a/conda/cli/main_package.py
+++ b/conda/cli/main_package.py
@@ -263,9 +263,11 @@ def which_package(path):
     if prefix is None:
         from ..exceptions import CondaVerificationError
         raise CondaVerificationError("could not determine conda prefix from: %s" % path)
+
+    from ..common.path import paths_equal
     for dist in linked(prefix):
         meta = is_linked(prefix, dist)
-        if any(abspath(join(prefix, f)) == path for f in meta['files']):
+        if any(paths_equal(join(prefix, f), path) for f in meta['files']):
             yield dist
 
 
diff --git a/conda/common/path.py b/conda/common/path.py
--- a/conda/common/path.py
+++ b/conda/common/path.py
@@ -3,7 +3,7 @@
 
 from functools import reduce
 import os
-from os.path import basename, dirname, join, split, splitext
+from os.path import basename, dirname, join, split, splitext, abspath, normpath
 import re
 
 from .compat import on_win, string_types
@@ -42,6 +42,16 @@ def is_path(value):
     return re.match(PATH_MATCH_REGEX, value)
 
 
+def paths_equal(path1, path2):
+    """
+    Examples:
+        >>> paths_equal('/a/b/c', '/a/b/c/d/..')
+        True
+
+    """
+    return normpath(abspath(path1)) == normpath(abspath(path2))
+
+
 @memoize
 def url_to_path(url):
     """Convert a file:// URL to a path.


Test patch:
Repository: conda/conda

Issue:
conda should take config information from --file and stdin

conda should take config information from --file and stdin



Discussion:

Resolving patch:
diff --git a/conda/cli/main_config.py b/conda/cli/main_config.py
--- a/conda/cli/main_config.py
+++ b/conda/cli/main_config.py
@@ -188,6 +188,11 @@ def configure_parser(sub_parsers):
         default=[],
         metavar="KEY",
     )
+    action.add_argument(
+        "--stdin",
+        action="store_true",
+        help="Apply configuration information given in yaml format piped through stdin.",
+    )
 
     p.add_argument(
         "-f", "--force",
@@ -354,6 +359,15 @@ def execute_config(args, parser):
                     else:
                         print("--add", key, repr(item))
 
+    if args.stdin:
+        content = sys.stdin.read()
+        try:
+            parsed = yaml_load(content)
+        except Exception:  # pragma: no cover
+            from ..exceptions import ParseError
+            raise ParseError("invalid yaml content:\n%s" % content)
+        rc_config.update(parsed)
+
     # prepend, append, add
     for arg, prepend in zip((args.prepend, args.append), (True, False)):
         sequence_parameters = [p for p in context.list_parameters()


Test patch:
Repository: conda/conda

Issue:
--yes not functioning for "Clean"
Hi, either `conda clean -y --all` or `conda clean --yes --all` still prompt for a confirmation. 

conda 4.2.13
macOS 10.12.4


Discussion:
@kalefranz should this be fixed for 4.1 onwards or?
Confirmed here as well.

`conda==4.2.13`  
`Windows 32-bit`
Probably at least 4.2 onward.

Resolving patch:
diff --git a/conda/cli/main_clean.py b/conda/cli/main_clean.py
--- a/conda/cli/main_clean.py
+++ b/conda/cli/main_clean.py
@@ -120,7 +120,7 @@ def rm_tarballs(args, pkgs_dirs, totalsize, verbose=True):
         print(fmt % ('Total:', human_bytes(totalsize)))
         print()
 
-    if not context.json:
+    if not context.json or not context.yes:
         confirm_yn(args)
     if context.json and args.dry_run:
         return
@@ -218,7 +218,7 @@ def rm_pkgs(args, pkgs_dirs, warnings, totalsize, pkgsizes,
         print(fmt % ('Total:', human_bytes(totalsize)))
         print()
 
-    if not context.json:
+    if not context.json or not context.yes:
         confirm_yn(args)
     if context.json and args.dry_run:
         return
@@ -279,7 +279,7 @@ def rm_source_cache(args, cache_dirs, warnings, cache_sizes, total_size):
 
     print("%-40s %10s" % ("Total:", human_bytes(total_size)))
 
-    if not context.json:
+    if not context.json or not context.yes:
         confirm_yn(args)
     if context.json and args.dry_run:
         return


Test patch:
Repository: conda/conda

Issue:
add short option for "--use-index-cache"
`--use-index-cache` makes search and info much faster, but it's a lot of characters to type.
Could you add a short equivalent?
To propose something: it could be a capital C like in yum/dnf:

```
      -C, --cacheonly
              Run  entirely  from system cache, don't update the cache and use
              it even in case it is expired.
```



Discussion:

Resolving patch:
diff --git a/conda/cli/conda_argparse.py b/conda/cli/conda_argparse.py
--- a/conda/cli/conda_argparse.py
+++ b/conda/cli/conda_argparse.py
@@ -381,20 +381,10 @@ def add_parser_known(p):
 
 def add_parser_use_index_cache(p):
     p.add_argument(
-        "--use-index-cache",
+        "-C", "--use-index-cache",
         action="store_true",
         default=False,
-        help="Use cache of channel index files.",
-    )
-
-
-def add_parser_no_use_index_cache(p):
-    p.add_argument(
-        "--no-use-index-cache",
-        action="store_false",
-        default=True,
-        dest="use_index_cache",
-        help="Force fetching of channel index files.",
+        help="Use cache of channel index files, even if it has expired.",
     )
 
 
diff --git a/conda/cli/main_remove.py b/conda/cli/main_remove.py
--- a/conda/cli/main_remove.py
+++ b/conda/cli/main_remove.py
@@ -13,10 +13,9 @@
 import sys
 
 from .conda_argparse import (add_parser_channels, add_parser_help, add_parser_insecure,
-                             add_parser_json, add_parser_no_pin, add_parser_no_use_index_cache,
-                             add_parser_offline, add_parser_prefix, add_parser_pscheck,
-                             add_parser_quiet, add_parser_use_index_cache, add_parser_use_local,
-                             add_parser_yes)
+                             add_parser_json, add_parser_no_pin, add_parser_offline,
+                             add_parser_prefix, add_parser_pscheck, add_parser_quiet,
+                             add_parser_use_index_cache, add_parser_use_local, add_parser_yes)
 
 help = "%s a list of packages from a specified conda environment."
 descr = help + """
@@ -82,7 +81,6 @@ def configure_parser(sub_parsers, name='remove'):
     add_parser_prefix(p)
     add_parser_quiet(p)
     # Putting this one first makes it the default
-    add_parser_no_use_index_cache(p)
     add_parser_use_index_cache(p)
     add_parser_use_local(p)
     add_parser_offline(p)


Test patch:
Repository: conda/conda

Issue:
We should add an alias to `ssl_verify` -> `verify_ssl`
Having this would allow to have parity with anaconda-client configuration and perhaps `verify_ssl` is a better name.

Thoughts @kalefranz ? 

----

Related to https://github.com/conda/conda/issues/5256


Discussion:

Resolving patch:
diff --git a/conda/base/context.py b/conda/base/context.py
--- a/conda/base/context.py
+++ b/conda/base/context.py
@@ -103,7 +103,7 @@ class Context(Configuration):
 
     # remote connection details
     ssl_verify = PrimitiveParameter(True, element_type=string_types + (bool,),
-                                    aliases=('insecure',),
+                                    aliases=('insecure', 'verify_ssl',),
                                     validation=ssl_verify_validation)
     client_ssl_cert = PrimitiveParameter(None, aliases=('client_cert',),
                                          element_type=string_types + (NoneType,))


Test patch: