On 18 January 2011 16:19, Konstantin Kolinko <knst.koli...@gmail.com> wrote:
> Hi!
>
> In 6.0.30 to fix BZ 49657 we changed the way how cgi command is built
> in CGI Servlet:
> http://svn.apache.org/viewvc?view=revision&revision=1004424
>
> Earlier implementation used to build the command as a single string,
> wrapping parts of it in double quotes. The new implementation uses
> Runtime.exec(String[]) and passes all arguments separate from each
> other as an array.
>
> This causes regression for people using empty value for "executable"
> init-param, as reported in
> https://issues.apache.org/bugzilla/show_bug.cgi?id=50606
>
> I closed BZ 50606 as INVALID but now I am changing my mind. Looking around
>
> 1) there are sites that recommend using an empty string for "executable"
> http://stackoverflow.com/questions/499456/cgi-and-tomcat/500527#500527
>
> Apparently it is to run programs that themselves are executables, as
> *.exe on Windows.

The empty string is assumed to be "perl", according to:

http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html#Configuration
and
http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html#Configuration

which says:

"executable - The of the executable to be used to run the script.
Default is perl." (sic)

BTW: s/The of/The name of/

> 2) some put in arguments for the executable, as "cmd /q /c"
> http://webcache.googleusercontent.com/search?q=cache:njmdNKdXzNMJ:www.tek-tips.com/faqs.cfm%3Ffid%3D6467
> (Should be http://www.tek-tips.com/faqs.cfm?fid=6467 but the original
> site is inaccessible now).
>
> I do not like to revert r1004424 and bother with quotes, nor I want to
> parse "executable" into separate strings.
> So I think of the following:
> 1. Allow empty value of "executable" init-param

See above.

> 2. Introduce additional init-params to explicitly specify additional 
> arguments:
> "executable-arg-1"
> "executable-arg-2"
> etc. starting with "1"
>
> So cmd /q /c will be written as
>
> <init-param>
>  <param-name>executable</param-name>
>  <param-value>cmd.exe</param-value>
> </init-param>
> <init-param>
>  <param-name>executable-arg-1</param-name>
>  <param-value>/q</param-value>
> </init-param>
> <init-param>
>  <param-name>executable-arg-2</param-name>
>  <param-value>/c</param-value>
> </init-param>
>
> What do you think?

Ant has a nicer format:

<exec executable="cmd">
    <arg value="/c"/>
    <arg value="ant.bat"/>
    <arg value="-p"/>
</exec>

This would be tricky to fit into the existing scheme, but something
similar could perhaps be added as an alternative to the current
scheme?

I.e. leave the existing scheme (and don't bother trying to deal with
quotes), and add the new scheme for handling parameters properly.

> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to