Re: svn commit: r372810 - /lucene/nutch/trunk/bin/nutch

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r372810 - /lucene/nutch/trunk/bin/nutch

Rod Taylor-2
Please don't do that.

        bash-2.05b$ ls  /bin/bash
        ls: /bin/bash: No such file or directory
       
        bash-2.05b$ uname -a
        FreeBSD home 6.0-RELEASE FreeBSD 6.0-RELEASE #13: Sat Nov  5
        00:19:49 EST 2005     root@home:/usr/obj/usr/src/sys/HOME  amd64
       
        bash-2.05b$ ls /bin/*sh
        /bin/csh        /bin/sh         /bin/tcsh

On Fri, 2006-01-27 at 10:45 +0000, [hidden email] wrote:

> Author: cutting
> Date: Fri Jan 27 02:45:35 2006
> New Revision: 372810
>
> URL: http://svn.apache.org/viewcvs?rev=372810&view=rev
> Log:
> Explicitly specify bash, since this script requires some bash-specific features.
>
> Modified:
>     lucene/nutch/trunk/bin/nutch
>
> Modified: lucene/nutch/trunk/bin/nutch
> URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/bin/nutch?rev=372810&r1=372809&r2=372810&view=diff
> ==============================================================================
> --- lucene/nutch/trunk/bin/nutch (original)
> +++ lucene/nutch/trunk/bin/nutch Fri Jan 27 02:45:35 2006
> @@ -1,4 +1,4 @@
> -#!/bin/sh
> +#!/bin/bash
>  #
>  # The Nutch command script
>  #
>
>
>
--
Rod Taylor <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r372810 - /lucene/nutch/trunk/bin/nutch

Doug Cutting-2
Rod Taylor wrote:

> Please don't do that.
>
>         bash-2.05b$ ls  /bin/bash
>         ls: /bin/bash: No such file or directory
>        
>         bash-2.05b$ uname -a
>         FreeBSD home 6.0-RELEASE FreeBSD 6.0-RELEASE #13: Sat Nov  5
>         00:19:49 EST 2005     root@home:/usr/obj/usr/src/sys/HOME  amd64
>        
>         bash-2.05b$ ls /bin/*sh
>         /bin/csh        /bin/sh         /bin/tcsh

Yes, the script would have run before, but it wouldn't have worked
correctly.  Now it fails with a clear reason: it requires bash.  Perhaps
we should go farther and remove the bash dependency.  This change didn't
break anything that wasn't already broken, nor fix anything.  It simply
made the failure mode more clear.

The problem is that for 90% of the maintainers of this script, /bin/sh
is bash, so it is hard to ensure that the use of bash features does not
creep into it.  Is installing bash on FreeBSD onerous?  It is the
default for Linux and for cygwin, which have far greater market share
than FreeBSD.  Requiring compatiblity with something that's difficult
for most developers to test makes it fragile, and I'd rather add a
dependency for FreeBSD and Solaris users than make this more fragile.

Doug
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r372810 - /lucene/nutch/trunk/bin/nutch

Rod Taylor-2
On Fri, 2006-01-27 at 10:34 -0800, Doug Cutting wrote:

> Rod Taylor wrote:
> > Please don't do that.
> >
> >         bash-2.05b$ ls  /bin/bash
> >         ls: /bin/bash: No such file or directory
> >        
> >         bash-2.05b$ uname -a
> >         FreeBSD home 6.0-RELEASE FreeBSD 6.0-RELEASE #13: Sat Nov  5
> >         00:19:49 EST 2005     root@home:/usr/obj/usr/src/sys/HOME  amd64
> >        
> >         bash-2.05b$ ls /bin/*sh
> >         /bin/csh        /bin/sh         /bin/tcsh
>
> Yes, the script would have run before, but it wouldn't have worked
> correctly.  Now it fails with a clear reason: it requires bash.  Perhaps
> we should go farther and remove the bash dependency.  This change didn't
> break anything that wasn't already broken, nor fix anything.  It simply
> made the failure mode more clear.
>
> The problem is that for 90% of the maintainers of this script, /bin/sh
> is bash, so it is hard to ensure that the use of bash features does not
> creep into it.  Is installing bash on FreeBSD onerous?  It is the

It is installed but the path is /usr/local/bin/bash like any other user
installed package would be on FreeBSD.

--
Rod Taylor <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r372810 - /lucene/nutch/trunk/bin/nutch

Andrzej Białecki-2
Rod Taylor wrote:
>> The problem is that for 90% of the maintainers of this script, /bin/sh
>> is bash, so it is hard to ensure that the use of bash features does not
>> creep into it.  Is installing bash on FreeBSD onerous?  It is the
>>    
>
> It is installed but the path is /usr/local/bin/bash like any other user
> installed package would be on FreeBSD.
>  

Hmm. I believe we could solve it by the following incantation (typing
from memory...):

---------- cut here -------------
#!/bin/sh
BASH=`which bash`
if [ "X$BASH" = "X" ]
then
    echo "This script requires Bash somewhere on your PATH"
    exit -1
fi
/bin/true; exec $BASH "$0" "$@"
---------- cut here -------------

Or yet another incantation:

---------- cut here -------------
#!/usr/bin/env bash
---------- cut here -------------

Both versions require Bash to work properly, but it doesn't matter where
it's installed.

--
Best regards,
Andrzej Bialecki     <><
 ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r372810 - /lucene/nutch/trunk/bin/nutch

Doug Cutting-2
Andrzej Bialecki wrote:
> #!/usr/bin/env bash

+1

This works on Solaris, Linux & cygwin.  Does it work on FreeBSD?

Doug
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r372810 - /lucene/nutch/trunk/bin/nutch

Rod Taylor-2
On Fri, 2006-01-27 at 13:37 -0800, Doug Cutting wrote:
> Andrzej Bialecki wrote:
> > #!/usr/bin/env bash
>
> +1
>
> This works on Solaris, Linux & cygwin.  Does it work on FreeBSD?

Yes. It will fail on some older and obscure systems but I don't imagine
those will have a JVM anyway.

--
Rod Taylor <[hidden email]>