classification
Title: pyvenv: activate.fish breaks $PATH for bash scripts
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Florian.Dold, Goneri Le Bouder, vinay.sajip
Priority: normal Keywords:

Created on 2016-03-31 15:49 by Florian.Dold, last changed 2016-04-05 17:46 by Goneri Le Bouder.

Messages (2)
msg262696 - (view) Author: Florian Dold (Florian.Dold) Date: 2016-03-31 15:49
When sourcing the activate script from bash, $PATH is restored from 
$_OLD_VIRTUAL_PATH.  If bash was invoked from fish (e.g. when running a shell script), and a virtualenv was activated from fish via activate.fish, the 
$_OLD_VIRTUAL_PATH will contain path separated by the ascii record separator char (chr(30)), since this is how the fish shell stores arrays.

But the activate script for bash will then set $PATH to $_OLD_VIRTUAL_PATH, which breaks most bash scripts.

Instead the activate scripts should differentiate between

$_OLD_BASH_VIRTUAL_PATH
and
$_OLD_FISH_VIRTUAL_PATH

or the activate.fish should take care to replace chr(30) with colons before it sets $_OLD_VIRTUAL_PATH.


bash$ pyvenv my-venv
bash$ fish
fish$ . my-venv/bin/activate.fish
fish$ bash
bash$ . my-venv/bin/activate
# $PATH is now broken, since it contains record separators instead of colons to separate paths
msg262916 - (view) Author: Goneri Le Bouder (Goneri Le Bouder) Date: 2016-04-05 17:46
A work around is to unset the _OLD_VIRTUAL_PATH variable before the activate:

set -e _OLD_VIRTUAL_PATH
History
Date User Action Args
2016-04-05 17:46:31Goneri Le Boudersetnosy: + Goneri Le Bouder
messages: + msg262916
2016-03-31 16:09:18SilentGhostsetnosy: + vinay.sajip
type: behavior
2016-03-31 15:49:21Florian.Doldcreate