-
Notifications
You must be signed in to change notification settings - Fork 49
Hard reset of environment variables VS ruby version managers #73
Comments
How about purging all vars with RUBY, GEM, BUNDLE in it and PATH, and leave the rest as is? |
Version managers are each setting their own vars, so it doesn't work to just clean some vars. Prax would have to know about all version managers and filter-out their variables —assuming they won't add more or change any. |
the important variables are set by the version managers, they are important for ruby not the manager, just make sure that the shell you use does not load any manager and resetting this variables should be enough: GEM_HOME
GEM_PATH + all listed here http://www.tutorialspoint.com/ruby/ruby_environment_variables.htm: DLN_LIBRARY_PATH # Search path for dynamically loaded modules.
HOME # Directory moved to when no argument is passed to Dir::chdir. Also used by File::expand_path to expand "~".
LOGDIR # Directory moved to when no arguments are passed to Dir::chdir and environment variable HOME isn't set.
PATH # Search path for executing subprocesses and searching for Ruby programs with the -S option. Separate each path with a colon (semicolon in DOS and Windows).
RUBYLIB # Search path for libraries. Separate each path with a colon (semicolon in DOS and Windows).
RUBYLIB_PREFIX # Used to modify the RUBYLIB search path by replacing prefix of library path1 with path2 using the format path1;path2 or path1path2.
RUBYOPT # Command-line options passed to Ruby interpreter. Ignored in taint mode (Where $SAFE is greater than 0).
RUBYPATH # With -S option, search path for Ruby programs. Takes precedence over PATH. Ignored in taint mode (where $SAFE is greater than 0).
RUBYSHELL # Specifies shell for spawned processes. If not set, SHELL or COMSPEC are checked. JRuby and RBX might have few more, @headius & @brixen - can you fill in? |
Thanks for the hint @mpapis ! I'll try with a blacklist solution. |
JRuby should obey the RUBY* env vars. We have also heard of bugs when there's no HOME set, but it's uncommon. Additional for JRuby: JRUBY_OPTS I'd have to audit the codebase to get a complete list. |
Anything prefixed with |
ah I would have forgotten, there is set of variables starting with |
Thanks for the input. I'll try a nicer cleanup of shell environment. Right now I only let |
I'm hard resetting the environment variables to almost nothing, in order for ruby version managers to not be influenced by the ruby version Prax is currently running with.
The problem is that the reset is so hard that not even
HOME
,USER
andUID
are kept.I'm wondering how to correctly fix that problem: have a whitelist of environment variables that must be kept? Keep a hash of the original environment variables? Something else?
The text was updated successfully, but these errors were encountered: