[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: wrapper script issue



Side bar:

As i was just trying to clean up my hackish maneuvers in /usr/bin, I noticed that there are two packages installed.  One is ruby and one is ruby1.8.  The plain ruby seems to do little more than install a ruby link to the versioned ruby binary.  Is this all it does?  What do you call this kind of package?

On Feb 8, 2008 4:08 PM, Bob McGowan <bob_mcgowan@symantec.com> wrote:
Bob McGowan wrote:
> Ken Irving wrote:
>> On Fri, Feb 08, 2008 at 02:02:30PM -0700, ChadDavis wrote:
>>> First of all, I have wrapped my ruby binary in wrapper script as just
>>> indicated. the wrapper script is called "ruby1.8" and here's the

< elided stuff >

> So, I guess the questions are:
>
> 1.  Do you have a /usr/bin/ruby1.8 and is it a binary file (about 3336
> bytes)?
>
> 2.  Does /etc/alternatives/ruby1.8 exist and what type of file is it?
>
> 3.  Where is your wrapper script ruby1.8 located?
>
> 4.  And, if both the wrapper ruby1.8 and /usr/bin/ruby1.8 exist, in
> different places, and your wrapper is executable, which of the two is
> being found in the PATH search?
>

So, my questions got answered, even as I was sending them.  What you
have, then, is this:

  $ matz.rb
    generates:
       /usr/bin/ruby1.8 /path/to/script/matz.rb # wrapper
    generates
       /bin/sh /usr/bin/ruby1.8
    does:
       export variable
       exec /etc/alternatives/ruby1.8 /usr/bin/ruby1.8

The only place the original file gets mentioned is at the very
beginning, it does not pass through to the real ruby1.8 command.

So, what does ruby do when it sees a file with "#!/bin/sh" at the
beginning, let alone the 'exec' line?

I really can't say what exactly is letting things get back to the 'puts'
in the original script file, what I can say is this setup looks to me
like it won't work.  Of course, this assumes my analysis is correct.

I'll be mulling this over, I'm sure, I can't let a good problem like
this rest ;)  So, hopefully sooner than later, it will get solved.

--
Bob McGowan
Symantec, Inc.


Reply to: