[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

ENV["PATH"] is being overwritten (in Ruby 1.4.6

primehalo

11/8/2004 11:20:00 PM

I'm having a weird problem where accessing the PATH environment
variable overwrites it with a different path. As an example:

/scripts/script1.rb:
#!/usr/bin/ruby
puts `env | grep PATH`
puts ENV["PATH"]
puts `/usr/bin/env | grep PATH`

Command Line:
[testing]% script1.rb
/bin:/usr/bin:/usr/local/bin:.:/scripts
/bin:/usr
PATH=/bin:/usr
[testing]%

I have to put the full path for "env" the second time otherwise I'd
get "sh: env: command not found". And I don't know where the "/usr"
directory comes from. I've searched all the files in my home
directory, and don't see it setting just "/usr" to the path anywhere.
I also searched through the files in the Ruby directory and never see
a "/usr" by itself.

This is a project that I inherited which uses Ruby 1.4.6 on a RedHat
Linux 6.1J. I copied it onto my RedHat Linux 6.1J machine, and
upgraded Ruby to fix the problem. Unfortunately, the scripts are not
quite compatible with the updated Ruby, so I had to revert to the
version that was originally used.
11 Answers

primehalo

11/9/2004 5:17:00 AM

0

primehalo@hotmail.com (Ken Innes) wrote in message news:<70452692.0411081519.60aa8c87@posting.google.com>...
> I'm having a weird problem where accessing the PATH environment
> variable overwrites it with a different path. As an example:
>
> /scripts/script1.rb:
> #!/usr/bin/ruby
> puts `env | grep PATH`
> puts ENV["PATH"]
> puts `/usr/bin/env | grep PATH`
>
> Command Line:
> [testing]% script1.rb
> /bin:/usr/bin:/usr/local/bin:.:/scripts
> /bin:/usr
> PATH=/bin:/usr
> [testing]%
>
> I have to put the full path for "env" the second time otherwise I'd
> get "sh: env: command not found". And I don't know where the "/usr"
> directory comes from. I've searched all the files in my home
> directory, and don't see it setting just "/usr" to the path anywhere.
> I also searched through the files in the Ruby directory and never see
> a "/usr" by itself.
>
> This is a project that I inherited which uses Ruby 1.4.6 on a RedHat
> Linux 6.1J. I copied it onto my RedHat Linux 6.1J machine, and
> upgraded Ruby to fix the problem. Unfortunately, the scripts are not
> quite compatible with the updated Ruby, so I had to revert to the
> version that was originally used.

I did more testing, and found that the path is getting truncated after
"/bin:/usr". My .tcshrc looked like so:
set path = ( /bin )
set path = ( $path /usr/bin )
set path = ( $path /usr/local/bin )
set path = ( $path . )
set path = ( $path /scripts )

Then I added a few lines, and it still truncated at the same spot:
set path = ( /bin )
set path = ( $path /test1/usr )
set path = ( $path /test1/usr/test2 )
set path = ( $path /usr/bin )
set path = ( $path /usr/local/bin )
set path = ( $path . )
set path = ( $path /scripts )

Gave this after executing the script:
PATH=/bin:/test1/usr:/test1/usr/test2:/usr

However, it does not seem to truncate at all if put /usr as the first
one:
set path = ( /usr )
set path = ( $path /bin )
set path = ( $path /usr/bin )
set path = ( $path /usr/local/bin )
set path = ( $path . )
set path = ( $path /scripts )

I really don't understand this at all.

Eric Hodel

11/9/2004 5:18:00 PM

0

Ken Innes (primehalo@hotmail.com) wrote:

> primehalo@hotmail.com (Ken Innes) wrote in message news:<70452692.0411081519.60aa8c87@posting.google.com>...
> > I'm having a weird problem where accessing the PATH environment
> > variable overwrites it with a different path. As an example:
> >
> > /scripts/script1.rb:
> > #!/usr/bin/ruby
> > puts `env | grep PATH`
> > puts ENV["PATH"]
> > puts `/usr/bin/env | grep PATH`
> >
> > Command Line:
> > [testing]% script1.rb
> > /bin:/usr/bin:/usr/local/bin:.:/scripts
> > /bin:/usr
> > PATH=/bin:/usr
> > [testing]%
> >
> > I have to put the full path for "env" the second time otherwise I'd
> > get "sh: env: command not found". And I don't know where the "/usr"
> > directory comes from. I've searched all the files in my home
> > directory, and don't see it setting just "/usr" to the path anywhere.
> > I also searched through the files in the Ruby directory and never see
> > a "/usr" by itself.
> >
> > This is a project that I inherited which uses Ruby 1.4.6 on a RedHat
> > Linux 6.1J. I copied it onto my RedHat Linux 6.1J machine, and
> > upgraded Ruby to fix the problem. Unfortunately, the scripts are not
> > quite compatible with the updated Ruby, so I had to revert to the
> > version that was originally used.
>
> I did more testing, and found that the path is getting truncated after
> "/bin:/usr". My .tcshrc looked like so:

[path snippage]

> I really don't understand this at all.

A thought came up on IRC:

Are you using RedHat's Ruby 1.4.6, or a hand-built one? RedHat has been
known to "fix" packages in the past. Either tcsh or ruby may have been
modified to give this behavior. You can find a Ruby 1.4.6 source
tarball from a mirror off of ruby-lang.org. (Holler if you can't find
it.)

Second, are there any binaries or scripts in /usr? It is unusual to
have anything other than directories in that path, perhaps your version
of tcsh has a bug that truncates the path when nothing executable is
found?

--
Eric Hodel - drbrain@segment7.net - http://se...
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

primehalo

11/10/2004 11:03:00 PM

0


Eric Hodel wrote:
> Ken Innes (primehalo@hotmail.com) wrote:
>
> > primehalo@hotmail.com (Ken Innes) wrote in message
news:<70452692.0411081519.60aa8c87@posting.google.com>...
> > > I'm having a weird problem where accessing the PATH environment
> > > variable overwrites it with a different path. As an example:
> > >
> > > /scripts/script1.rb:
> > > #!/usr/bin/ruby
> > > puts `env | grep PATH`
> > > puts ENV["PATH"]
> > > puts `/usr/bin/env | grep PATH`
> > >
> > > Command Line:
> > > [testing]% script1.rb
> > > /bin:/usr/bin:/usr/local/bin:.:/scripts
> > > /bin:/usr
> > > PATH=/bin:/usr
> > > [testing]%
> > >
> > > I have to put the full path for "env" the second time otherwise
I'd
> > > get "sh: env: command not found". And I don't know where the
"/usr"
> > > directory comes from. I've searched all the files in my home
> > > directory, and don't see it setting just "/usr" to the path
anywhere.
> > > I also searched through the files in the Ruby directory and never
see
> > > a "/usr" by itself.
> > >
> > > This is a project that I inherited which uses Ruby 1.4.6 on a
RedHat
> > > Linux 6.1J. I copied it onto my RedHat Linux 6.1J machine, and
> > > upgraded Ruby to fix the problem. Unfortunately, the scripts are
not
> > > quite compatible with the updated Ruby, so I had to revert to the
> > > version that was originally used.
> >
> > I did more testing, and found that the path is getting truncated
after
> > "/bin:/usr". My .tcshrc looked like so:
>
> [path snippage]
>
> > I really don't understand this at all.
>
> A thought came up on IRC:
>
> Are you using RedHat's Ruby 1.4.6, or a hand-built one? RedHat has
been
> known to "fix" packages in the past. Either tcsh or ruby may have
been
> modified to give this behavior. You can find a Ruby 1.4.6 source
> tarball from a mirror off of ruby-lang.org. (Holler if you can't
find
> it.)
>
> Second, are there any binaries or scripts in /usr? It is unusual to
> have anything other than directories in that path, perhaps your
version
> of tcsh has a bug that truncates the path when nothing executable is
> found?
>
> --
> Eric Hodel - drbrain@segment7.net - http://se...
> All messages signed with fingerprint:
> FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

I originally installed the RedHat version of Ruby (ruby-1.4.6.tar.gz),
then I switched to the Ruby that the original developers had included
with the project (also ruby-1.4.6.tar.gz). I switched in hopes it would
fix the problem, but it made no difference. There was nothing special
about the install except that I had to specify host:
% ./configure --host=i686-pc-linux
% make
% make test
% make install

How would I tell if tcsh was modified? I installed this version of
Linux myself, and nobody else here touches it.

There is nothing in the /usr directory besides other directories. In my
test, I created blank directories but they didn't get truncated.

Eric Hodel

11/10/2004 11:45:00 PM

0

On Nov 10, 2004, at 3:13 PM, primehalo@hotmail.com wrote:

> Eric Hodel wrote:
>> Ken Innes (primehalo@hotmail.com) wrote:
>>
>>> primehalo@hotmail.com (Ken Innes) wrote in message
>>> news:<70452692.0411081519.60aa8c87@posting.google.com>...
>>>
>>> I did more testing, and found that the path is getting truncated
>>> after
>>> "/bin:/usr". My .tcshrc looked like so:
>>
>> [path snippage]
>>
>>> I really don't understand this at all.
>>
>> A thought came up on IRC:
>>
>> Are you using RedHat's Ruby 1.4.6, or a hand-built one? RedHat has
>> been
>> known to "fix" packages in the past. Either tcsh or ruby may have
>> been
>> modified to give this behavior. You can find a Ruby 1.4.6 source
>> tarball from a mirror off of ruby-lang.org. (Holler if you can't find
>> it.)
>>
>> Second, are there any binaries or scripts in /usr? It is unusual to
>> have anything other than directories in that path, perhaps your
>> version
>> of tcsh has a bug that truncates the path when nothing executable is
>> found?
>
> I originally installed the RedHat version of Ruby (ruby-1.4.6.tar.gz),
> then I switched to the Ruby that the original developers had included
> with the project (also ruby-1.4.6.tar.gz). I switched in hopes it would
> fix the problem, but it made no difference. There was nothing special
> about the install except that I had to specify host:
> % ./configure --host=i686-pc-linux
> % make
> % make test
> % make install
>
> How would I tell if tcsh was modified? I installed this version of
> Linux myself, and nobody else here touches it.

If you installed it using only RedHat 6 packages, you have have a
modified version of tcsh. The only way to tell would be to install the
same version of tcsh from original sources and see if the problem goes
away.

> There is nothing in the /usr directory besides other directories. In my
> test, I created blank directories but they didn't get truncated.

Try removing /usr from your path, since it won't help you find any
binaries... Maybe it truncates the path because it has only
directories?



Blink003

9/14/2009 10:01:00 PM

0


"Diberville" <Diberville@gmail.com> a ?crit dans le message de news:
7h7pifF2sbn3cU3@mid.individual.net...
> S'pion a ?crit :
>>
>> ?D?j?, on savait que le gouvernement Charest allait hausser la TVQ de
>> 7,5% ? 8,5%, ? compter de janvier 2011, mais voil? qu'on examine la
>> possibilit? d'augmenter cette taxe ? la consommation d'un autre point de
>> pourcentage d?s 2010.?
>
> Faites comme : commandez tout ce que vous pouvez ? Vancouver...
>

Et fais-toi fourer par le transport et la garantie.



Jean Munier

9/14/2009 10:13:00 PM

0


"Blink003" <addr@invalide.com> wrote in message
news:h8mefd$qvd$1@news.eternal-september.org...
>
> "Diberville" <Diberville@gmail.com> a ?crit dans le
> message de news: 7h7pifF2sbn3cU3@mid.individual.net...
>> S'pion a ?crit :
>>>
>>> ?D?j?, on savait que le gouvernement Charest allait
>>> hausser la TVQ de 7,5% ? 8,5%, ? compter de janvier
>>> 2011, mais voil? qu'on examine la possibilit?
>>> d'augmenter cette taxe ? la consommation d'un autre
>>> point de pourcentage d?s 2010.?
>>
>> Faites comme : commandez tout ce que vous pouvez ?
>> Vancouver...
>>
>
> Et fais-toi fourer par le transport et la garantie.
>

Transport et manutention, d'accord ; mais la garantie, s'il
s'agit d'une garantie de l'importateur, du fabricant ou
d'une cha?ne de magasins pr?sente dans tout le Canada, ne
devrait pr?senter aucun probl?me. Il se pourra toutefois
qu'il faille renvoyer le bidule ? Burnaby, C.-B., plut?t
qu'? Hamilton, Ont.

J.

J.


D'Iberville

9/14/2009 10:19:00 PM

0

Jean Munier a ?crit :
> "Blink003" <addr@invalide.com> wrote in message
> news:h8mefd$qvd$1@news.eternal-september.org...
>> "Diberville" <Diberville@gmail.com> a ?crit dans le
>> message de news: 7h7pifF2sbn3cU3@mid.individual.net...
>>> S'pion a ?crit :
>>>> ?D?j?, on savait que le gouvernement Charest allait
>>>> hausser la TVQ de 7,5% ? 8,5%, ? compter de janvier
>>>> 2011, mais voil? qu'on examine la possibilit?
>>>> d'augmenter cette taxe ? la consommation d'un autre
>>>> point de pourcentage d?s 2010.?
>>> Faites comme : commandez tout ce que vous pouvez ?
>>> Vancouver...
>>>
>> Et fais-toi fourer par le transport et la garantie.
>>
>
> Transport et manutention, d'accord ; mais la garantie, s'il
> s'agit d'une garantie de l'importateur, du fabricant ou
> d'une cha?ne de magasins pr?sente dans tout le Canada, ne
> devrait pr?senter aucun probl?me. Il se pourra toutefois
> qu'il faille renvoyer le bidule ? Burnaby, C.-B., plut?t
> qu'? Hamilton, Ont.
>

J'ai d?j? command? des ordinateurs, des disques dur et des tas de trucs
du genre ? Vancouver, Toronto ou New-York
Je n'ai jamais connu ni bris ni perte.
Et m?me avec les frais de transport, j'?tais encore gagnant sur le prix
qu?b?cois...


--
Saviez-vous que... : http://diberville.blo...
Le blogue-notes de Diberville : http://diberville.livejo...
"Davon geht die Welt nicht unter, sieht man sie manchmal auch grau".

Jean Munier

9/14/2009 10:24:00 PM

0


"Diberville" <Diberville@gmail.com> wrote in message
news:7h7ts5F2rokt6U2@mid.individual.net...
> Jean Munier a ?crit :
>> "Blink003" <addr@invalide.com> wrote in message
>> news:h8mefd$qvd$1@news.eternal-september.org...
>>> "Diberville" <Diberville@gmail.com> a ?crit dans le
>>> message de news: 7h7pifF2sbn3cU3@mid.individual.net...
>>>> S'pion a ?crit :
>>>>> ?D?j?, on savait que le gouvernement Charest allait
>>>>> hausser la TVQ de 7,5% ? 8,5%, ? compter de janvier
>>>>> 2011, mais voil? qu'on examine la possibilit?
>>>>> d'augmenter cette taxe ? la consommation d'un autre
>>>>> point de pourcentage d?s 2010.?
>>>> Faites comme : commandez tout ce que vous pouvez ?
>>>> Vancouver...
>>>>
>>> Et fais-toi fourer par le transport et la garantie.
>>>
>>
>> Transport et manutention, d'accord ; mais la garantie,
>> s'il s'agit d'une garantie de l'importateur, du fabricant
>> ou d'une cha?ne de magasins pr?sente dans tout le Canada,
>> ne devrait pr?senter aucun probl?me. Il se pourra
>> toutefois qu'il faille renvoyer le bidule ? Burnaby,
>> C.-B., plut?t qu'? Hamilton, Ont.
>>
>
> J'ai d?j? command? des ordinateurs, des disques dur et des
> tas de trucs du genre ? Vancouver, Toronto ou New-York
> Je n'ai jamais connu ni bris ni perte.
> Et m?me avec les frais de transport, j'?tais encore
> gagnant sur le prix qu?b?cois...
>
>

C'est vrai que les retours de marchandise sous le couvert
d'une garantie sont tr?s rares. Si on voulait ?tre m?chant,
on dirait qu'un bidule qui a une dur?e de vie pr?vue de 3
ans sera couvert par une garantie ["limit?e", ce que
personne ne sait ce que ?a veut dire] d'un an...

J.


Victal

9/15/2009 9:38:00 AM

0

Diberville wrote:
> Jean Munier a ?crit :
>> "Blink003" <addr@invalide.com> wrote in message
>> news:h8mefd$qvd$1@news.eternal-september.org...
>>> "Diberville" <Diberville@gmail.com> a ?crit dans le
>>> message de news: 7h7pifF2sbn3cU3@mid.individual.net...
>>>> S'pion a ?crit :
>>>>> ?D?j?, on savait que le gouvernement Charest allait
>>>>> hausser la TVQ de 7,5% ? 8,5%, ? compter de janvier
>>>>> 2011, mais voil? qu'on examine la possibilit?
>>>>> d'augmenter cette taxe ? la consommation d'un autre
>>>>> point de pourcentage d?s 2010.?
>>>> Faites comme : commandez tout ce que vous pouvez ?
>>>> Vancouver...
>>>>
>>> Et fais-toi fourer par le transport et la garantie.
>>>
>>
>> Transport et manutention, d'accord ; mais la garantie, s'il
>> s'agit d'une garantie de l'importateur, du fabricant ou
>> d'une cha?ne de magasins pr?sente dans tout le Canada, ne
>> devrait pr?senter aucun probl?me. Il se pourra toutefois
>> qu'il faille renvoyer le bidule ? Burnaby, C.-B., plut?t
>> qu'? Hamilton, Ont.


>>
>
> J'ai d?j? command? des ordinateurs, des disques dur et des tas de
> trucs du genre ? Vancouver, Toronto ou New-York
> Je n'ai jamais connu ni bris ni perte.
> Et m?me avec les frais de transport, j'?tais encore gagnant sur le
> prix qu?b?cois...

oui mais vous ouibliez d'inclure le co?t de l'empreinte environnementale

Oh mais je sais ca se voit pas sur une facture



--
? Il n'existe pas de nuit assez profonde pour arr?ter un rayon de
lumi?re et pourtant le vide ne s'?claire pas; la lumi?re ne prend
corps que dans l'oil qui la re?oit ?

Extrait de sous-Bois d'A.G.


D'Iberville

9/15/2009 10:13:00 AM

0

Victal a ?crit :
> Diberville wrote:
>> Jean Munier a ?crit :
>>> "Blink003" <addr@invalide.com> wrote in message
>>> news:h8mefd$qvd$1@news.eternal-september.org...
>>>> "Diberville" <Diberville@gmail.com> a ?crit dans le
>>>> message de news: 7h7pifF2sbn3cU3@mid.individual.net...
>>>>> S'pion a ?crit :
>>>>>> ?D?j?, on savait que le gouvernement Charest allait
>>>>>> hausser la TVQ de 7,5% ? 8,5%, ? compter de janvier
>>>>>> 2011, mais voil? qu'on examine la possibilit?
>>>>>> d'augmenter cette taxe ? la consommation d'un autre
>>>>>> point de pourcentage d?s 2010.?
>>>>> Faites comme : commandez tout ce que vous pouvez ?
>>>>> Vancouver...
>>>>>
>>>> Et fais-toi fourer par le transport et la garantie.
>>>>
>>> Transport et manutention, d'accord ; mais la garantie, s'il
>>> s'agit d'une garantie de l'importateur, du fabricant ou
>>> d'une cha?ne de magasins pr?sente dans tout le Canada, ne
>>> devrait pr?senter aucun probl?me. Il se pourra toutefois
>>> qu'il faille renvoyer le bidule ? Burnaby, C.-B., plut?t
>>> qu'? Hamilton, Ont.
>
>
>> J'ai d?j? command? des ordinateurs, des disques dur et des tas de
>> trucs du genre ? Vancouver, Toronto ou New-York
>> Je n'ai jamais connu ni bris ni perte.
>> Et m?me avec les frais de transport, j'?tais encore gagnant sur le
>> prix qu?b?cois...
>
> oui mais vous ouibliez d'inclure le co?t de l'empreinte environnementale

Vous croyez que ce que vous achetez ? 5 % + 7.5 % de taxes chez Future
Shop Montr?al est produit au Qu?bec ?


--
Saviez-vous que... : http://diberville.blo...
Le blogue-notes de Diberville : http://diberville.livejo...
"Davon geht die Welt nicht unter, sieht man sie manchmal auch grau".