# Ruby 1.4.6 - trouble with require path

**URL:** <https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616>\
**Category:** ruby-talk\
**Created:** [5 November 2004 01:53 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616 "2004-11-05T01:53:43Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Primehalo](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@Primehalo](https://rubytalk.org/u/Primehalo)\
**Post date:** [5 November 2004 01:53 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/1 "2004-11-05T01:53:43Z")

</div>

I inherited a project that uses Ruby 1.4.6 on a RedHat Linux 6.1J. I  
copied it onto my RedHat Linux 6.1J machine, but there is a problem  
when I try to build it; the ruby scripts are unable to find required  
files (located in the same directory as the scripts) when the script  
is executed from a different directory. I upgraded to Ruby 1.6.7,  
which fixed that problem, but the scripts are not quite compatible  
with the updated Ruby, so I had to revert to the version that was  
originally used.

As an example, lets say I have two ruby scripts in a directory:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script1.rb:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;require "script2"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Testing...\n"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command Prompt:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]# cd /scripts  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[scripts]# script1.rb  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Testing...  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[scripts]# cd /testing  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]# script1.rb  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script1.rb:2:in `require': No such file to load -- script2  
(LoadError)

With Ruby 1.6.7, it works fine. With Ruby 1.4.6, it can find  
script1.rb, but not script2.rb.

There must be a way to correct this, as the project apparently worked  
for the original developers. I'm using the same OS, and I added the  
same ruby options and script directory to my path as specified in  
their readme (well almost, they said put it in .cshrc, but I had to  
put it in .tcshrc for it to work):  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYOPT '-Ke -rkconv'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set path = ( $path /scripts)

I also tried the following:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYOPT '-Ke -rkconv -S'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setenv LOAD\_PATH /scripts  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYLIB /scripts

So what am I missing here? Does anyone know how I can get this to work  
correctly WITHOUT ALTERING THE SCRIPTS (because there are hundreds of  
scripts)?

---

<div class="post-metadata">

**Author:** ![Ara.T.Howard6](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Ara.T.Howard6](https://rubytalk.org/u/Ara.T.Howard6)\
**Post date:** [5 November 2004 02:33 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/2 "2004-11-05T02:33:42Z")

</div>

i can't help you at all, but i'm dying to know: what project have you  
inherited with hundreds of 1.4.6?

-a

> **···**
>
> On Thu, 4 Nov 2004, Ken Innes wrote:
> 
> > I inherited a project that uses Ruby 1.4.6 on a RedHat Linux 6.1J. I  
> > copied it onto my RedHat Linux 6.1J machine, but there is a problem  
> > when I try to build it; the ruby scripts are unable to find required  
> > files (located in the same directory as the scripts) when the script  
> > is executed from a different directory. I upgraded to Ruby 1.6.7,  
> > which fixed that problem, but the scripts are not quite compatible  
> > with the updated Ruby, so I had to revert to the version that was  
> > originally used.
> > 
> > As an example, lets say I have two ruby scripts in a directory:  
> > &nbsp;&nbsp;&nbsp;&nbsp;/scripts/script1.rb:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;require "script2"
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Testing...\n"
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;Command Prompt:  
> > &nbsp;&nbsp;&nbsp;&nbsp;[testing]# cd /scripts  
> > &nbsp;&nbsp;&nbsp;&nbsp;[scripts]# script1.rb  
> > &nbsp;&nbsp;&nbsp;&nbsp;Testing...  
> > &nbsp;&nbsp;&nbsp;&nbsp;[scripts]# cd /testing  
> > &nbsp;&nbsp;&nbsp;&nbsp;[testing]# script1.rb  
> > &nbsp;&nbsp;&nbsp;&nbsp;script1.rb:2:in `require': No such file to load -- script2  
> > (LoadError)
> > 
> > With Ruby 1.6.7, it works fine. With Ruby 1.4.6, it can find  
> > script1.rb, but not script2.rb.
> > 
> > There must be a way to correct this, as the project apparently worked  
> > for the original developers. I'm using the same OS, and I added the  
> > same ruby options and script directory to my path as specified in  
> > their readme (well almost, they said put it in .cshrc, but I had to  
> > put it in .tcshrc for it to work):  
> > &nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYOPT '-Ke -rkconv'  
> > &nbsp;&nbsp;&nbsp;&nbsp;set path = ( $path /scripts)
> > 
> > I also tried the following:  
> > &nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYOPT '-Ke -rkconv -S'  
> > &nbsp;&nbsp;&nbsp;&nbsp;setenv LOAD\_PATH /scripts  
> > &nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYLIB /scripts
> > 
> > So what am I missing here? Does anyone know how I can get this to work  
> > correctly WITHOUT ALTERING THE SCRIPTS (because there are hundreds of  
> > scripts)?
> 
> # --
> 
> > EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov  
> > PHONE :: 303.497.6469  
> > When you do something, you should burn yourself completely, like a good  
> > bonfire, leaving no trace of yourself. --Shunryu Suzuki
> 
> ===============================================================================

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [5 November 2004 06:16 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/3 "2004-11-05T06:16:43Z")

</div>

> I inherited a project that uses Ruby 1.4.6 on a RedHat Linux 6.1J. I  
> copied it onto my RedHat Linux 6.1J machine, but there is a problem  
> when I try to build it; the ruby scripts are unable to find required  
> files (located in the same directory as the scripts) when the script  
> is executed from a different directory. I upgraded to Ruby 1.6.7,  
> which fixed that problem, but the scripts are not quite compatible  
> with the updated Ruby, so I had to revert to the version that was  
> originally used.
> 
> As an example, lets say I have two ruby scripts in a directory:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script1.rb:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;require "script2"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Testing...\n"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command Prompt:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]# cd /scripts  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[scripts]# script1.rb  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Testing...  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[scripts]# cd /testing  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]# script1.rb  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script1.rb:2:in `require': No such file to load -- script2  
> (LoadError)
> 
> With Ruby 1.6.7, it works fine. With Ruby 1.4.6, it can find  
> script1.rb, but not script2.rb.

While I believe you, I don't see how ruby can see from /testing into  
/scripts.

> There must be a way to correct this, as the project apparently worked  
> for the original developers. I'm using the same OS, and I added the  
> same ruby options and script directory to my path as specified in  
> their readme (well almost, they said put it in .cshrc, but I had to  
> put it in .tcshrc for it to work):  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYOPT '-Ke -rkconv'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set path = ( $path /scripts)
> 
> I also tried the following:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYOPT '-Ke -rkconv -S'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setenv LOAD\_PATH /scripts

> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYLIB /scripts

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^^^^^^^^^^^^^^^^^^^^^^^

This should do the trick.

You can verify this with something like:

cd /testing

ruby14 -e 'p $:' -r /scripts/script1.rb

/scripts should be the first thing in the array.

> So what am I missing here? Does anyone know how I can get this to work  
> correctly WITHOUT ALTERING THE SCRIPTS (because there are hundreds of  
> scripts)?

PS: I now have a ruby14 installed!

> **···**
>
> Ken Innes (primehalo@hotmail.com) wrote:
> 
> --  
> Eric Hodel - drbrain@segment7.net - [http://segment7.net](http://segment7.net)  
> All messages signed with fingerprint:  
> FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

---

<div class="post-metadata">

**Author:** ![David\_Ross](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@David\_Ross](https://rubytalk.org/u/David_Ross)\
**Post date:** [5 November 2004 02:36 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/4 "2004-11-05T02:36:59Z")

</div>

heh, I'm suprised they kept that many scripts without adjusting to other releases. I'm curious myself as well. Insane it is =]

David Ross

> **···**
>
> Ara.T.Howard@noaa.gov wrote:
> 
> > On Thu, 4 Nov 2004, Ken Innes wrote:
> > 
> > > I inherited a project that uses Ruby 1.4.6 on a RedHat Linux 6.1J. I  
> > > copied it onto my RedHat Linux 6.1J machine, but there is a problem  
> > > when I try to build it; the ruby scripts are unable to find required  
> > > files (located in the same directory as the scripts) when the script  
> > > is executed from a different directory. I upgraded to Ruby 1.6.7,  
> > > which fixed that problem, but the scripts are not quite compatible  
> > > with the updated Ruby, so I had to revert to the version that was  
> > > originally used.
> > > 
> > > As an example, lets say I have two ruby scripts in a directory:  
> > > &nbsp;&nbsp;&nbsp;&nbsp;/scripts/script1.rb:  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;require "script2"
> > > 
> > > &nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Testing...\n"
> > > 
> > > &nbsp;&nbsp;&nbsp;&nbsp;Command Prompt:  
> > > &nbsp;&nbsp;&nbsp;&nbsp;[testing]# cd /scripts  
> > > &nbsp;&nbsp;&nbsp;&nbsp;[scripts]# script1.rb  
> > > &nbsp;&nbsp;&nbsp;&nbsp;Testing...  
> > > &nbsp;&nbsp;&nbsp;&nbsp;[scripts]# cd /testing  
> > > &nbsp;&nbsp;&nbsp;&nbsp;[testing]# script1.rb  
> > > &nbsp;&nbsp;&nbsp;&nbsp;script1.rb:2:in `require': No such file to load -- script2  
> > > (LoadError)
> > > 
> > > With Ruby 1.6.7, it works fine. With Ruby 1.4.6, it can find  
> > > script1.rb, but not script2.rb.
> > > 
> > > There must be a way to correct this, as the project apparently worked  
> > > for the original developers. I'm using the same OS, and I added the  
> > > same ruby options and script directory to my path as specified in  
> > > their readme (well almost, they said put it in .cshrc, but I had to  
> > > put it in .tcshrc for it to work):  
> > > &nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYOPT '-Ke -rkconv'  
> > > &nbsp;&nbsp;&nbsp;&nbsp;set path = ( $path /scripts)
> > > 
> > > I also tried the following:  
> > > &nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYOPT '-Ke -rkconv -S'  
> > > &nbsp;&nbsp;&nbsp;&nbsp;setenv LOAD\_PATH /scripts  
> > > &nbsp;&nbsp;&nbsp;&nbsp;setenv RUBYLIB /scripts
> > > 
> > > So what am I missing here? Does anyone know how I can get this to work  
> > > correctly WITHOUT ALTERING THE SCRIPTS (because there are hundreds of  
> > > scripts)?
> > 
> > i can't help you at all, but i'm dying to know: what project have you  
> > inherited with hundreds of 1.4.6?
> > 
> > -a  
> > --
> 
> --  
> Hazzle free packages for Ruby?  
> RPA is available from [http://www.rubyarchive.org/](http://www.rubyarchive.org/)

---

<div class="post-metadata">

**Author:** ![Brian\_Candler](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Brian\_Candler](https://rubytalk.org/u/Brian_Candler)\
**Post date:** [5 November 2004 09:43 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/5 "2004-11-05T09:43:58Z")

</div>

> PS: I now have a ruby14 installed!

If you go to the list archive at  
&nbsp;&nbsp;[http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml](http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml)  
and do a "(Subjects, Regular Expression)" search, the bottom of the second  
frame still carries a graphic saying:

"Ruby 1.1: Enjoy Multi-thread Programming by Ruby."

🙂

---

<div class="post-metadata">

**Author:** ![Primehalo](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@Primehalo](https://rubytalk.org/u/Primehalo)\
**Post date:** [6 November 2004 05:18 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/6 "2004-11-06T05:18:41Z")

</div>

Well, "setenv RUBYLIB /scripts" was the right solution. I don't quite  
understand what was going on; RUBYLIB was set (as verified by typing  
"setenv"), but Ruby couldn't find the scripts until I restarted the  
computer. Then it seemed to work fine.

But now I'm having another weird problem where accessing the PATH  
environment variable is causing Ruby not find scripts. For example:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script1.rb:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print `script3.rb`

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ENV["PATH"].split(/:/).each { |i|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#do nothing  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print `script3.rb`

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script3.rb:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Testing...\n"

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command Prompt:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[scripts]# cd /testing  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]# script1.rb  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Testing....  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]# script2.rb  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/testing/script2:4: command not found: script3

Any access to ENV["PATH"] seems to cause the problem, for example:  
print ENV["PATH"]  
tmp = ENV["PATH"]  
ENV["PATH"].chomp!

Any ideas on this one?

---

<div class="post-metadata">

**Author:** ![Primehalo](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@Primehalo](https://rubytalk.org/u/Primehalo)\
**Post date:** [6 November 2004 04:03 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/7 "2004-11-06T04:03:43Z")

</div>

David Ross \<dross@code-exec.net\> wrote in message news:\<418AE839.9040401@code-exec.net\>...

> **···**
>
> > Ara.T.Howard@noaa.gov wrote:
> > 
> > \> On Thu, 4 Nov 2004, Ken Innes wrote:  
> > \>  
> > \>\> I inherited a project that uses Ruby 1.4.6 on a RedHat Linux 6.1J. I  
> > \>\> copied it onto my RedHat Linux 6.1J machine, but there is a problem  
> > \>\> when I try to build it; the ruby scripts are unable to find required  
> > \>\> files (located in the same directory as the scripts) when the script  
> > \>\> is executed from a different directory. I upgraded to Ruby 1.6.7,  
> > \>\> which fixed that problem, but the scripts are not quite compatible  
> > \>\> with the updated Ruby, so I had to revert to the version that was  
> > \>\> originally used.  
> > \>\>  
> > \>\> As an example, lets say I have two ruby scripts in a directory:  
> > \>\> /scripts/script1.rb:  
> > \>\> #!/usr/bin/ruby  
> > \>\> require "script2"  
> > \>\>  
> > \>\> /scripts/script2.rb:  
> > \>\> print "Testing...\n"  
> > \>\>  
> > \>\> Command Prompt:  
> > \>\> [testing]# cd /scripts  
> > \>\> [scripts]# script1.rb  
> > \>\> Testing...  
> > \>\> [scripts]# cd /testing  
> > \>\> [testing]# script1.rb  
> > \>\> script1.rb:2:in `require': No such file to load -- script2  
> > \>\> (LoadError)  
> > \>\>  
> > \>\> With Ruby 1.6.7, it works fine. With Ruby 1.4.6, it can find  
> > \>\> script1.rb, but not script2.rb.  
> > \>\>  
> > \>\> There must be a way to correct this, as the project apparently worked  
> > \>\> for the original developers. I'm using the same OS, and I added the  
> > \>\> same ruby options and script directory to my path as specified in  
> > \>\> their readme (well almost, they said put it in .cshrc, but I had to  
> > \>\> put it in .tcshrc for it to work):  
> > \>\> setenv RUBYOPT '-Ke -rkconv'  
> > \>\> set path = ( $path /scripts)  
> > \>\>  
> > \>\> I also tried the following:  
> > \>\> setenv RUBYOPT '-Ke -rkconv -S'  
> > \>\> setenv LOAD\_PATH /scripts  
> > \>\> setenv RUBYLIB /scripts  
> > \>\>  
> > \>\> So what am I missing here? Does anyone know how I can get this to work  
> > \>\> correctly WITHOUT ALTERING THE SCRIPTS (because there are hundreds of  
> > \>\> scripts)?  
> > \>  
> > \>  
> > \> i can't help you at all, but i'm dying to know: what project have you  
> > \> inherited with hundreds of 1.4.6?  
> > \>  
> > \> -a  
> > \> --
> > 
> > heh, I'm suprised they kept that many scripts without adjusting to other  
> > releases. I'm curious myself as well. Insane it is =]
> > 
> > David Ross
> 
> Can't go into details, but it's a project from Japan that was finished  
> years ago, probably when version 1.4.6 was current, or at least  
> near-current.

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [6 November 2004 07:35 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/8 "2004-11-06T07:35:38Z")

</div>

Looking at the code for ENV., I don't see anything that would cause  
this, unless there's some bug in your libc with getenv.

Perhaps you should try a bash-like shell instead of a csh-like shell?

Oh, try this:

puts ENV["PATH"]  
puts `env | grep path`

See if your PATH is really destroyed.

> **···**
>
> Ken Innes (primehalo@hotmail.com) wrote:
> 
> > Well, "setenv RUBYLIB /scripts" was the right solution. I don't quite  
> > understand what was going on; RUBYLIB was set (as verified by typing  
> > "setenv"), but Ruby couldn't find the scripts until I restarted the  
> > computer. Then it seemed to work fine.
> > 
> > But now I'm having another weird problem where accessing the PATH  
> > environment variable is causing Ruby not find scripts. For example:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script1.rb:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print `script3.rb`
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ENV["PATH"].split(/:/).each { |i|  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#do nothing  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print `script3.rb`
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script3.rb:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Testing...\n"
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command Prompt:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[scripts]# cd /testing  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]# script1.rb  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Testing....  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]# script2.rb  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/testing/script2:4: command not found: script3
> > 
> > Any access to ENV["PATH"] seems to cause the problem, for example:  
> > print ENV["PATH"]  
> > tmp = ENV["PATH"]  
> > ENV["PATH"].chomp!
> > 
> > Any ideas on this one?
> 
> --  
> Eric Hodel - drbrain@segment7.net - [http://segment7.net](http://segment7.net)  
> All messages signed with fingerprint:  
> FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

---

<div class="post-metadata">

**Author:** ![Primehalo](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@Primehalo](https://rubytalk.org/u/Primehalo)\
**Post date:** [8 November 2004 21:28 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/9 "2004-11-08T21:28:35Z")

</div>

Eric Hodel \<drbrain@segment7.net\> wrote in message news:\<20041106073536.GK93473@segment7.net\>...

> \> Well, "setenv RUBYLIB /scripts" was the right solution. I don't quite  
> \> understand what was going on; RUBYLIB was set (as verified by typing  
> \> "setenv"), but Ruby couldn't find the scripts until I restarted the  
> \> computer. Then it seemed to work fine.  
> \>  
> \> But now I'm having another weird problem where accessing the PATH  
> \> environment variable is causing Ruby not find scripts. For example:  
> \> /scripts/script1.rb:  
> \> #!/usr/bin/ruby  
> \> print `script3.rb`  
> \>  
> \> /scripts/script2.rb:  
> \> #!/usr/bin/ruby  
> \> ENV["PATH"].split(/:/).each { |i|  
> \> #do nothing  
> \> }  
> \> print `script3.rb`  
> \>  
> \> /scripts/script3.rb:  
> \> #!/usr/bin/ruby  
> \> print "Testing...\n"  
> \>  
> \> Command Prompt:  
> \> [scripts]# cd /testing  
> \> [testing]# script1.rb  
> \> Testing....  
> \> [testing]# script2.rb  
> \> /testing/script2:4: command not found: script3  
> \>  
> \> Any access to ENV["PATH"] seems to cause the problem, for example:  
> \> print ENV["PATH"]  
> \> tmp = ENV["PATH"]  
> \> ENV["PATH"].chomp!  
> \>  
> \> Any ideas on this one?
> 
> Looking at the code for ENV., I don't see anything that would cause  
> this, unless there's some bug in your libc with getenv.
> 
> Perhaps you should try a bash-like shell instead of a csh-like shell?
> 
> Oh, try this:
> 
> puts ENV["PATH"]  
> puts `env | grep path`
> 
> See if your PATH is really destroyed.

My default shell is bash, but I change to csh to run their scripts (as  
that's what it said to do in their readme file). Still, I have tried  
it in both shells with the same results.

Anyway, I tried your suggestion, and here's what happens:

Try 1:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts ENV["PATH"]  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts `env | grep path`

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command Line:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]% script2.rb  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/bin:/usr  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sh: env: command not found  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]%

Didn't work because I referenced ENV["PATH"] so it couldn't find  
"env".

Try 2:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts ENV["PATH"]  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts `/usr/bin/env | grep path`

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command Line:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]% script2.rb  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/bin:/usr  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]%

Probably put a blank line because of a difference in case.

Try 3:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts ENV["PATH"]  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts `/usr/bin/env | grep PATH`

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command Line:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]% script2.rb  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/bin:/usr  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PATH=/bin:/usr  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]%

The PATH environment variable still seems to be in tact, but Ruby  
still can't find any files that are in PATH directories after  
ENV["PATH"] is accessed.

> **···**
>
> > Ken Innes (primehalo@hotmail.com) wrote:

---

<div class="post-metadata">

**Author:** ![Primehalo](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@Primehalo](https://rubytalk.org/u/Primehalo)\
**Post date:** [8 November 2004 22:53 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/10 "2004-11-08T22:53:35Z")

</div>

Oops, actually, my path did get messed up. I didn't notice before  
(must be Monday), but there are several directories missing from the  
PATH, including the /scripts directory. So I just did another test:

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command Line:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]% script2.rb  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/bin:/usr/bin:/usr/local/bin:.:/scripts  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/bin:/usr  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PATH=/bin:/usr  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]%

And I notice that there is no "/usr" initially, but it's there after  
the ENV["PATH"] is referenced. I've searched all the files in my home  
directory, and don't see it setting just "/usr" to the path anywhere.  
I also search through the files in the Ruby directory, and also never  
see a "/usr" by itself.

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [9 November 2004 01:39 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/11 "2004-11-09T01:39:48Z")

</div>

Hrm...

I'm not sure what the equivalent is on RedHat, but what about looking /etc/csh.\*

There should be default a default .cshrc and .login there, do they have any odd paths?

> **···**
>
> On Nov 8, 2004, at 2:53 PM, Ken Innes wrote:
> 
> > Oops, actually, my path did get messed up. I didn't notice before  
> > (must be Monday), but there are several directories missing from the  
> > PATH, including the /scripts directory. So I just did another test:
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/scripts/script2.rb:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/usr/bin/ruby  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts `env | grep PATH`  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts ENV["PATH"]  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts `/usr/bin/env | grep PATH`
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command Line:  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]% script2.rb  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/bin:/usr/bin:/usr/local/bin:.:/scripts  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/bin:/usr  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PATH=/bin:/usr  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[testing]%
> > 
> > And I notice that there is no "/usr" initially, but it's there after  
> > the ENV["PATH"] is referenced. I've searched all the files in my home  
> > directory, and don't see it setting just "/usr" to the path anywhere.  
> > I also search through the files in the Ruby directory, and also never  
> > see a "/usr" by itself.

---

<div class="post-metadata">

**Author:** ![Primehalo](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@Primehalo](https://rubytalk.org/u/Primehalo)\
**Post date:** [9 November 2004 05:18 UTC](https://rubytalk.org/t/ruby-1-4-6-trouble-with-require-path/14616/12 "2004-11-09T05:18:35Z")

</div>

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

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

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

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

I really don't understand this at all.
