timofurrer / try

Dead simple CLI tool to try Python packages - It's never been easier! :package:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tmpdir could be created in a noexec location

jrd opened this issue · comments

If you have /tmp mounted with the safe option noexec, try will fail to activate virtualenv:

$ LANG= try requests
==> Use python python2.7
[*] Downloading packages: requests
/bin/sh: env/bin/activate: No such file or directory
[*] Command 'python -m pip install requests >> logs' exited with error code: 1. See /tmp/try-x05IFY/logs

If I remount /tmp with exec right it works:

$ LANG= try requests
==> Use python python2.7
[*] Downloading packages: requests
/tmp/try-cRSmIg/env/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
You are using pip version 7.1.2, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Python 2.7.5 (default, May 29 2013, 02:28:51) 
[GCC 4.8.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

The SSLContext and pip version warnings are not related to this issue.

I see ... Would you be happy about having a cmd line option to set the tmpdir path?
I think for the most people /tmp is mounted without noexec - that's why I think /tmp is still a good place for this.

Since release 0.2.0 try supports the --tmpdir option to specify the base location for the temporary directory.
In your case it would make sense to add this value to the try configuration file like this:

File: ~/.config/try/config.ini (this location depends on your OS - See click.get_app_dir doc)

[env]
tmpdir=~/.try

Thanks, that's great!