Repository: conda/conda

Issue:
conda 4.4.0rc2 AssertionError on 'conda create'
    "command": "/home/travis/miniconda/bin/conda create -y -p /home/travis/build/conda/conda-build/tests/conda_build_bootstrap_test git"

```
Traceback (most recent call last):
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 265, in _make_single_record
    repodata_record = read_repodata_json(extracted_package_dir)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/gateways/disk/read.py\", line 123, in read_repodata_json
    with open(join(extracted_package_directory, 'info', 'repodata_record.json')) as fi:
FileNotFoundError: [Errno 2] No such file or directory: '/home/travis/miniconda/pkgs/test_source_files-1-0/info/repodata_record.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 276, in _make_single_record
    index_json_record = read_index_json(extracted_package_dir)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/gateways/disk/read.py\", line 111, in read_index_json
    with open(join(extracted_package_directory, 'info', 'index.json')) as fi:
FileNotFoundError: [Errno 2] No such file or directory: '/home/travis/miniconda/pkgs/test_source_files-1-0/info/index.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/exceptions.py\", line 683, in __call__
    return func(*args, **kwargs)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/main.py\", line 78, in _main
    exit_code = do_call(args, p)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/conda_argparse.py\", line 75, in do_call
    exit_code = getattr(module, func_name)(args, parser)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/main_create.py\", line 11, in execute
    install(args, parser, 'create')
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/install.py\", line 241, in install
    handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/cli/install.py\", line 258, in handle_txn
    unlink_link_transaction.display_actions(progressive_fetch_extract)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/link.py\", line 704, in display_actions
    legacy_action_groups = self.make_legacy_action_groups(pfe)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/link.py\", line 687, in make_legacy_action_groups
    pfe.prepare()
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 504, in prepare
    for prec in self.link_precs)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 504, in <genexpr>
    for prec in self.link_precs)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 399, in make_actions_for_record
    ), None)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 396, in <genexpr>
    pcrec for pcrec in concat(PackageCache(pkgs_dir).query(pref_or_spec)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 397, in <genexpr>
    for pkgs_dir in context.pkgs_dirs)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 116, in query
    return (pcrec for pcrec in itervalues(self._package_cache_records) if pcrec == param)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 208, in _package_cache_records
    return self.__package_cache_records or self.load() or self.__package_cache_records
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 88, in load
    package_cache_record = self._make_single_record(base_name)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/core/package_cache.py\", line 291, in _make_single_record
    extract_tarball(package_tarball_full_path, extracted_package_dir)
  File \"/home/travis/miniconda/lib/python3.6/site-packages/conda-4.4.0rc2.post15+0dc8573d-py3.6.egg/conda/gateways/disk/create.py\", line 133, in extract_tarball
    assert not lexists(destination_directory), destination_directory
AssertionError: /home/travis/miniconda/pkgs/test_source_files-1-0
```


Discussion:
This was in Travix CI, and a post 4.4.0rc2 version.

Resolving patch:
diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py
--- a/conda/cli/main_info.py
+++ b/conda/cli/main_info.py
@@ -195,33 +195,25 @@ def get_info_dict(system=False):
         info_dict['UID'] = os.geteuid()
         info_dict['GID'] = os.getegid()
 
-    if system:
-        evars = {
-            'CIO_TEST',
-            'CONDA_DEFAULT_ENV',
-            'CONDA_ENVS_PATH',
-            'DYLD_LIBRARY_PATH',
-            'FTP_PROXY',
-            'HTTP_PROXY',
-            'HTTPS_PROXY',
-            'LD_LIBRARY_PATH',
-            'PATH',
-            'PYTHONHOME',
-            'PYTHONPATH',
-            'REQUESTS_CA_BUNDLE',
-            'SSL_CERT_FILE',
-        }
-
-        evars.update(v for v in os.environ if v.startswith('CONDA_'))
-        evars.update(v for v in os.environ if v.startswith('conda_'))
-
-        info_dict.update({
-            'sys.version': sys.version,
-            'sys.prefix': sys.prefix,
-            'sys.executable': sys.executable,
-            'site_dirs': get_user_site(),
-            'env_vars': {ev: os.getenv(ev, os.getenv(ev.lower(), '<not set>')) for ev in evars},
-        })
+    evars = {
+        'CIO_TEST',
+        'REQUESTS_CA_BUNDLE',
+        'SSL_CERT_FILE',
+    }
+
+    # add all relevant env vars, e.g. startswith('CONDA') or endswith('PATH')
+    evars.update(v for v in os.environ if v.upper().startswith('CONDA'))
+    evars.update(v for v in os.environ if v.upper().startswith('PYTHON'))
+    evars.update(v for v in os.environ if v.upper().endswith('PROXY'))
+    evars.update(v for v in os.environ if v.upper().endswith('PATH'))
+
+    info_dict.update({
+        'sys.version': sys.version,
+        'sys.prefix': sys.prefix,
+        'sys.executable': sys.executable,
+        'site_dirs': get_user_site(),
+        'env_vars': {ev: os.getenv(ev, os.getenv(ev.lower(), '<not set>')) for ev in evars},
+    })
 
     return info_dict
 


Test patch:
diff --git a/tests/test_info.py b/tests/test_info.py
--- a/tests/test_info.py
+++ b/tests/test_info.py
@@ -31,12 +31,8 @@ def test_info():
     conda_info_s_out, conda_info_s_err, rc = run_command(Commands.INFO, '-s')
     assert_equals(conda_info_s_err, '')
     for name in ['sys.version', 'sys.prefix', 'sys.executable', 'conda location',
-                 'conda-build', 'CONDA_DEFAULT_ENV', 'PATH', 'PYTHONPATH']:
+                 'conda-build', 'PATH']:
         assert_in(name, conda_info_s_out)
-    if context.platform == 'linux':
-        assert_in('LD_LIBRARY_PATH', conda_info_s_out)
-    if context.platform == 'osx':
-        assert_in('DYLD_LIBRARY_PATH', conda_info_s_out)
 
     conda_info_all_out, conda_info_all_err, rc = run_command(Commands.INFO, '--all')
     assert_equals(conda_info_all_err, '')