[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Who added this to my $PATH?

Albert Schlef

5/7/2009 8:09:00 AM

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.
--
Posted via http://www.ruby-....

9 Answers

Robert Dober

5/7/2009 8:54:00 AM

0

On Thu, May 7, 2009 at 10:08 AM, Albert Schlef <albertschlef@gmail.com> wro=
te:
> 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.

--
Antoine de Saint-Exup=E9ry

Eric Hodel

5/8/2009 5:24:00 PM

0

On May 7, 2009, at 1:08, Albert Schlef <albertschlef@gmail.com> 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.)

Robert Dober

5/9/2009 8:14:00 AM

0

On Fri, May 8, 2009 at 7:24 PM, Eric Hodel <drbrain@segment7.net> wrote:
> On May 7, 2009, at 1:08, Albert Schlef <albertschlef@gmail.com> wrote:
>
>> 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 binari=
es
>> 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


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

--
Antoine de Saint-Exup=E9ry

Eric Hodel

5/9/2009 9:41:00 PM

0

On May 9, 2009, at 01:13, Robert Dober wrote:
> On Fri, May 8, 2009 at 7:24 PM, Eric Hodel <drbrain@segment7.net>
> wrote:
>> On May 7, 2009, at 1:08, Albert Schlef <albertschlef@gmail.com>
>> 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.
>>
> 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.

Robert Dober

5/10/2009 9:10:00 AM

0

On Sat, May 9, 2009 at 11:41 PM, Eric Hodel <drbrain@segment7.net> wrote:
> On May 9, 2009, at 01:13, Robert Dober wrote:
>>
>> On Fri, May 8, 2009 at 7:24 PM, Eric Hodel <drbrain@segment7.net> wrote:
>>>
>>> On May 7, 2009, at 1:08, Albert Schlef <albertschlef@gmail.com> wrote:
>>>
>>>> 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.
>>>
>>> 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 you=
r
>>> PATH.
>>>
>> 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
--=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.

--
Antoine de Saint-Exup=E9ry

Brian Candler

5/11/2009 9:22:00 AM

0

Albert Schlef 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.
--
Posted via http://www.ruby-....

Robert Dober

5/11/2009 9:31:00 AM

0

On Mon, May 11, 2009 at 11:21 AM, Brian Candler <b.candler@pobox.com> wrote=
:
> Albert Schlef wrote:
>> I've just found the following line in my ~/.bashrc:
>>
>> =A0 PATH=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.
>
> 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-....

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.

--
Antoine de Saint-Exup=E9ry

Brian Candler

5/11/2009 9:47:00 AM

0

Robert Dober wrote:
> On Mon, May 11, 2009 at 11:21 AM, Brian Candler <b.candler@pobox.com>
> 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-....
>
> 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.
--
Posted via http://www.ruby-....

Albert Schlef

5/11/2009 10:12:00 AM

0

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.)
--
Posted via http://www.ruby-....