Who added this to my $PATH?

I’ve just found the following line in my ~/.bashrc:

PATH=$PATH:~/.gem/ruby/1.8/bin

Now, that’s vey beautiful. Instead of cluttering /usr/bin, everythig
goes in ~/.gem/ruby/1.8/bin.

But I wonder. Who added this line to my ~/.bashrc? I doubt it’s me,
because, IIRC, just today I discovered the fact the RubyGems puts
binaries there.

On Thu, May 7, 2009 at 10:08 AM, Albert S. [email protected]
wrote:

I’ve just found the following line in my ~/.bashrc:

PATH=$PATH:~/.gem/ruby/1.8/bin

Now, that’s vey beautiful. Instead of cluttering /usr/bin, everythig
goes in ~/.gem/ruby/1.8/bin.

But I wonder. Who added this line to my ~/.bashrc? I doubt it’s me,
because, IIRC, just today I discovered the fact the RubyGems puts
binaries there.
I bet it was you, unless someone else installed ruby-gems ;).
I agree however that there might be better solutions than to pollute
your PATH environement variable. But as I am unable to provide one I
will certainly not complain.

BTW IIANM this does not happen in 1.9 anymore.

Cheers
Robert


Si tu veux construire un bateau …
Ne rassemble pas des hommes pour aller chercher du bois, préparer des
outils, répartir les tâches, alléger le travail… mais enseigne aux
gens la nostalgie de l’infini de la mer.

If you want to build a ship, don’t herd people together to collect
wood and don’t assign them tasks and work, but rather teach them to
long for the endless immensity of the sea.

On May 7, 2009, at 1:08, Albert S. [email protected] wrote:

I’ve just found the following line in my ~/.bashrc:

PATH=$PATH:~/.gem/ruby/1.8/bin

Now, that’s vey beautiful. Instead of cluttering /usr/bin, everythig
goes in ~/.gem/ruby/1.8/bin.

But I wonder. Who added this line to my ~/.bashrc? I doubt it’s me,
because, IIRC, just today I discovered the fact the RubyGems puts
binaries there.

It wasn’t RubyGems, however RubyGems does warn you if you have --user-
install (current default) and don’t have the user bin for in your PATH.

I’d be surprised if some other gem added the path for you.

(I wouldn’t add the code to do this to RubyGems as there’s too many
shells to support.)

On Fri, May 8, 2009 at 7:24 PM, Eric H. [email protected] wrote:

because, IIRC, just today I discovered the fact the RubyGems puts binaries
there.

It wasn’t RubyGems, however RubyGems does warn you if you have
–user-install (current default) and don’t have the user bin for in your
PATH.

Eric I did not think of RubyGems, but rather of the gem itself. Do you
think this is possible?
Cheers
Robert


Si tu veux construire un bateau …
Ne rassemble pas des hommes pour aller chercher du bois, préparer des
outils, répartir les tâches, alléger le travail… mais enseigne aux
gens la nostalgie de l’infini de la mer.

If you want to build a ship, don’t herd people together to collect
wood and don’t assign them tasks and work, but rather teach them to
long for the endless immensity of the sea.

On May 9, 2009, at 01:13, Robert D. wrote:

goes in ~/.gem/ruby/1.8/bin.

Eric I did not think of RubyGems, but rather of the gem itself. Do you
think this is possible?

It’s possible, but it wouldn’t happen at install time.

On Sat, May 9, 2009 at 11:41 PM, Eric H. [email protected]
wrote:

Now, that’s vey beautiful. Instead of cluttering /usr/bin, everythig

Eric I did not think of RubyGems, but rather of the gem itself. Do you
think this is possible?

It’s possible, but it wouldn’t happen at install time.
I guess it is really time for me to learn about Rubygems I was
convinced that gem install can run post install hooks which could do
about anything in the system.
If you have a safety net about this, well I’am impressed.
Cheers
Robert

Si tu veux construire un bateau …
Ne rassemble pas des hommes pour aller chercher du bois, préparer des
outils, répartir les tâches, alléger le travail… mais enseigne aux
gens la nostalgie de l’infini de la mer.

If you want to build a ship, don’t herd people together to collect
wood and don’t assign them tasks and work, but rather teach them to
long for the endless immensity of the sea.

Albert S. wrote:

I’ve just found the following line in my ~/.bashrc:

PATH=$PATH:~/.gem/ruby/1.8/bin

Now, that’s vey beautiful. Instead of cluttering /usr/bin, everythig
goes in ~/.gem/ruby/1.8/bin.

But I wonder. Who added this line to my ~/.bashrc? I doubt it’s me,
because, IIRC, just today I discovered the fact the RubyGems puts
binaries there.

How did you install RubyGems? If it came from an O/S package then maybe
its post-install script did it for you.

BTW, Ubuntu didn’t do this for me - I had to sort out my own path to
get /var/lib/gems/1.8/bin in there.

On Mon, May 11, 2009 at 11:21 AM, Brian C. [email protected]
wrote:

binaries there.

How did you install RubyGems? If it came from an O/S package then maybe
its post-install script did it for you.

BTW, Ubuntu didn’t do this for me - I had to sort out my own path to
get /var/lib/gems/1.8/bin in there.

Posted via http://www.ruby-forum.com/.

I reread the OP again and again, because it is obvious (to me now)
that Eric and you assume that OP did just install Rubygems. He did not
say so. I still have this strange feeling that some gem did this to
him. Maybe one he was writing himself?

Cheers
Robert


Si tu veux construire un bateau …
Ne rassemble pas des hommes pour aller chercher du bois, préparer des
outils, répartir les tâches, alléger le travail… mais enseigne aux
gens la nostalgie de l’infini de la mer.

If you want to build a ship, don’t herd people together to collect
wood and don’t assign them tasks and work, but rather teach them to
long for the endless immensity of the sea.

Hi, I’m the original poster.

I hope that a gem author would
not do something so obviously dangerous

After thinking more about this, I think there’s 70% probablity that it
was I who added that line to that file. It’s just that I don’t remember
this. I do remember that I was writing a certain gem that had an
executable I experimented with. So let’s make it a 85% probability.

And since it’s hard to believe any alien script would add that line,
we’ll have to conclude that it is indeed my own handiwork.

How about “ls -l .bashrc” to see when it was last changed?

I tried that, but I might have edited that file since.

I’d better put all my config file in a git repository.

If a nefarious gem is suspected of making this change, then he can
probably find it using a variant of

grep -R bashrc /usr/lib/ruby/gems/1.8

(I cleaned up my system, so many of the gems I had aren’t there
anymore.)

Robert D. wrote:

On Mon, May 11, 2009 at 11:21 AM, Brian C. [email protected]
wrote:

binaries there.

How did you install RubyGems? If it came from an O/S package then maybe
its post-install script did it for you.

BTW, Ubuntu didn’t do this for me - I had to sort out my own path to
get /var/lib/gems/1.8/bin in there.

Posted via http://www.ruby-forum.com/.

I reread the OP again and again, because it is obvious (to me now)
that Eric and you assume that OP did just install Rubygems. He did not
say so. I still have this strange feeling that some gem did this to
him. Maybe one he was writing himself?

He didn’t say he’d only just installed RubyGems, but he did say that
he’d only just noticed this extension to his PATH in .bashrc. The fact
that he’d only just noticed it doesn’t necessarily mean that it hasn’t
been there all the time since he installed RubyGems.

How about “ls -l .bashrc” to see when it was last changed? (Not valid if
he’s been editing it manually of course)

Now, if he had installed RubyGems via the system’s package management
system, then I agree it could have touched /etc/bashrc but would be very
unlikely to touch ~/.bashrc in everyone’s home directory.

Check in /etc/skel/.bashrc to see if this has been set as a global
default for new accounts?

If a nefarious gem is suspected of making this change, then he can
probably find it using a variant of

grep -R bashrc /usr/lib/ruby/gems/1.8

assuming it’s still installed. However I hope that a gem author would
not do something so obviously dangerous and tied to a specific
architecture.

Regards,

Brian.