Mantis - Resin
Viewing Issue Advanced Details
1521 minor always 12-20-06 14:48 01-01-07 11:07
mca  
ferg  
normal  
closed 3.0.22  
fixed  
none    
none 3.0.23  
0001521: wrapper.pl, httpd.sh don't quote arguments sufficiently to allow arguments with embedded semicolons
When I start Resin, I need to pass in a JDBC URL as a system property. The jTDS JDBC driver's URL separates driver options with a semicolon, so I end up with a startup script that looks something like this:

rconf_jdbcURL="jdbc:jtds:sqlserver://$dbname/session;sendStringParametersAsUnicode=false" [^]
# ...
$RESIN_HOME/bin/httpd.sh -Drconf.jdbcURL="$rconf_jdbcURL" start

Httpd.sh and wrapper.pl don't completely preserve the necessary quoting around $rconf_jdbcURL, and as the arguments filter down to the point where the java process is actually launched, the embedded semicolon ends up terminating the command, and thus resin doesn't start.

The scripts can be fixed with very minor changes:

Differences ...

==== //depot/users/mca/resin/3.0/bin/httpd.sh#2 (xtext) ====

@@ -79,4 +79,4 @@

 bin=`dirname $script`

-exec $perl $bin/wrapper.pl -chdir -name "$name" -class "$class" $args $*
+exec $perl $bin/wrapper.pl -chdir -name "$name" -class "$class" $args ${1+"$@"}

==== //depot/users/mca/resin/3.0/bin/wrapper.pl#5 (xtext) ====

@@ -220,7 +220,7 @@
     }
     elsif ($ARGV[0] =~ "^-J") {
         $val = substr($ARGV[0], 2);
- $JAVA_ARGS .= " " . $val;
+ $JAVA_ARGS .= " '" . $val . "'";

         if ($val =~ "^-Xss") {
           $DEFAULT_STACK_SIZE = "";
@@ -229,7 +229,7 @@
        shift(@ARGV);
     }
     elsif ($ARGV[0] =~ "^-D") {
- $JAVA_ARGS .= " " . $ARGV[0];
+ $JAVA_ARGS .= " '" . $ARGV[0] . "'";
        shift(@ARGV);
     }
     elsif ($ARGV[0] =~ "^-javaagent"
@@ -240,7 +240,7 @@
     }
     elsif ($ARGV[0] =~ "^-X") {
         $val = $ARGV[0];
- $JAVA_ARGS .= " " . $val;
+ $JAVA_ARGS .= " '" . $val . "'";

         if ($val =~ "^-Xss") {
           $DEFAULT_STACK_SIZE = "";

There are no notes attached to this issue.