Who added this to my $PATH?

A

Albert Schlef

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.
 
R

Robert Dober

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

=A0PATH=3D$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



--=20
Si tu veux construire un bateau ...
Ne rassemble pas des hommes pour aller chercher du bois, pr=E9parer des
outils, r=E9partir les t=E2ches, all=E9ger le travail=85 mais enseigne aux
gens la nostalgie de l=92infini de la mer.

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

Eric Hodel

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.)
 
R

Robert Dober

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


--=20
Si tu veux construire un bateau ...
Ne rassemble pas des hommes pour aller chercher du bois, pr=E9parer des
outils, r=E9partir les t=E2ches, all=E9ger le travail=85 mais enseigne aux
gens la nostalgie de l=92infini de la mer.

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

Eric Hodel

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.
 
R

Robert Dober

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
--=20
Si tu veux construire un bateau ...
Ne rassemble pas des hommes pour aller chercher du bois, pr=E9parer des
outils, r=E9partir les t=E2ches, all=E9ger le travail=85 mais enseigne aux
gens la nostalgie de l=92infini de la mer.

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

Brian Candler

Albert said:
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.
 
R

Robert Dober

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.

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


--=20
Si tu veux construire un bateau ...
Ne rassemble pas des hommes pour aller chercher du bois, pr=E9parer des
outils, r=E9partir les t=E2ches, all=E9ger le travail=85 mais enseigne aux
gens la nostalgie de l=92infini de la mer.

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

Brian Candler

Robert said:
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.
 
A

Albert Schlef

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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,173
Messages
2,570,939
Members
47,484
Latest member
JackRichard

Latest Threads

Top