Ruby problem
Phil Dobbin
phildobbin at gmail.com
Wed Mar 14 22:58:42 PDT 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 15/03/2012 02:42, Brandon Allbery wrote:
> On Wed, Mar 14, 2012 at 16:35, Phil Dobbin <phildobbin at gmail.com
> <mailto:phildobbin at gmail.com>> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>
> On 14/03/2012 20:23, Jeremy Lavergne wrote:
>>> When MacPorts runs, it does of course clear most of the
>>> environment variables, including PATH, and set them to
>>> known-good values. But this should not affect anything outside
>>> of that MacPorts process. I don't know why your shell
>>> environment variables are changing in this way.
>>
>> Perhaps rvm itself is manipulating things?
>
> If Mac Ports clears most of the environment variables when run,
> should it not also return them to their original state before sudo
> was called when finished?
>
>
> Environment variable changes do not propagate to parent processes
> on Unix-like systems. MacPorts *cannot* affect the environment of
> the shell that called it.
>
> "rvm" may be a shell function (that kind of thing often is)
> specifically so it can manipulate its calling shell's environment.
> Possibly "sudo" is being wrapped in a function for the same reason
> (I do that locally but not to hack the environment). "port" is not
> and does not, unless someone there wrote their own wrapper for it.
rvm is a shell function. The comment on the script that's placed into
bash_profile on OS X & bashrc on Linux sez: # Load RVM into a shell
session *as a function* (their stars not mine).
The thing I find perplexing is that rvm doesn't use sudo (I'm using a
single-user install with all relevant files in $HOME) so rvm, whatever
its shortcomings may be, does not manipulate the $PATH when sudo is
called. It seems that Mac Ports clobbers the $PATH when sudo is
invoked leaving it in an indeterminate state from where it found it.
rvm is the only part of the shell environment that gets affected by
this however (perlbrew which serves a similar purpose for Perl is
quite unaffected in $HOME). In fact after invoking sudo, perlbrew
comes to the front of the $PATH followed by Mac Ports (see gist).
So in summation, calling sudo with Mac Ports is going to clobber rvm
in the present terminal & to get back to the normal state of things
it's either close all terminal windows (with six tabs open they all
get clobbered) & start a new session or either uninstall
/opt/local/bin's Ruby or rvm.
Cheers,
Phil...
- --
But masters, remember that I am an ass.
Though it be not written down,
yet forget not that I am an ass.
Wm. Shakespeare - Much Ado About Nothing
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: §auto-key-locate cert pka ldap hkp://keys.gnupg.net
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJPYYUPAAoJEKpMeDHWT5ADf0YH/3PO7up+Ad0tPs2t6uXjOE76
uY8A0asBFD0xlLuGDW+YYKBwHTLvGaZfGc8mbK2pSK+mWN+RiWKOrxda3xybmtU/
mDEN6+QqULv3WAXShr0cJDFVBr84NzYW62g52IriaBbMMu6KsUfloDTI3WvyftJn
nEtr9O2lFkE2TUQ10NbpgjN+fLk3fL2poXKv1mLpcOwDNmKLaCMnMAh8VUFRxLN2
qdZD+qO+OsfRxeQJekb64/jqGWnpmS/MQP1xRpIrNQQbjR5onoKQVCr/UPfAqx7c
6mOm0Vit+iUJiVfTBawKxTN6URag8JLOJ0/F+KJbsQHQFqPilguKgOPflseVoCI=
=A+yi
-----END PGP SIGNATURE-----
More information about the macports-users
mailing list