You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2021/04/13 19:18:53 UTC

[Bug 65240] New: Multi line CATALINA_OPTS is failing in with new catalina.sh

https://bz.apache.org/bugzilla/show_bug.cgi?id=65240

            Bug ID: 65240
           Summary: Multi line CATALINA_OPTS is failing in with new
                    catalina.sh
           Product: Tomcat 7
           Version: 7.0.108
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Integration
          Assignee: dev@tomcat.apache.org
          Reporter: egil@wp.pl
  Target Milestone: ---

Steps:
1. Add setenv.sh with multiline variable.
2. Run tomcat (e.g. via init.d script).

In log I got things like:
/usr/share/apache-tomcat-7.0.108/bin/catalina.sh: line 509:
-Dfile.encoding=UTF-8: command not found

This is with `sentenv.sh` more or less like this:
```
if [ "$1" != "stop" ] ; then
    CATALINA_OPTS="$CATALINA_OPTS -Xms512m -Xmx1800m -XX:MaxPermSize=512m
-XX:NewRatio=4 -XX:+UseCompressedOops
        -Dcom.sun.management.jmxremote
        -Dfile.encoding=UTF-8
    "
fi
```

There were more options but I guess any lines will be a problem there.

The solution for me was to change evals to something like:
eval exec "\"$_RUNJDB\"" "\"$CATALINA_LOGGING_CONFIG\"" $LOGGING_MANAGER
"$JAVA_OPTS" $CATALINA_OPTS \

So basically replace `"$CATALINA_OPTS"` with `$CATALINA_OPTS`.

Not sure why was this changed to quoted var? Seem to have worked fine before.
At least for us ;-)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65240] Multi line CATALINA_OPTS is failing in with new catalina.sh

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65240

Maciej Jaros <eg...@wp.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from Maciej Jaros <eg...@wp.pl> ---
Interesting case... Never had problem with stars in options. I guess because we
keep application options in a properties file (and just point to the properties
file).

Use case for multiline is quite simple really -- readability, editing and
cleaner diffs. I would be surprised if it's not a common way of doing that.

We have quite a lot of that so that so more like this on a devel machine:
```
        -DmolnetConfigLocation=file:$CATALINA_BASE/conf/app.properties
        -Dspring.profiles.active=.
        -Dcom.sun.management.jmxremote
        -Dcom.sun.management.jmxremote.port=.
        -Dcom.sun.management.jmxremote.ssl=.
        -Dcom.sun.management.jmxremote.authenticate=.
        -Dcom.sun.management.jmxremote.local.only=.
        -Djava.rmi.server.hostname=.
        -Dfile.encoding=.
        -agentlib:jdwp=.
```
Nice and easy to ready, change, copy. Great for diffs in git.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65240] Multi line CATALINA_OPTS is failing in with new catalina.sh

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65240

--- Comment #3 from mgrigorov <mg...@apache.org> ---
Can you use trailing '\':

 -DmolnetConfigLocation=file:$CATALINA_BASE/conf/app.properties \
        -Dspring.profiles.active=. \
        -Dcom.sun.management.jmxremote \
        -Dcom.sun.management.jmxremote.port=. \
        ...

?

I haven't tried it but I think it should work.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65240] Multi line CATALINA_OPTS is failing in with new catalina.sh

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65240

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Local testing confirms that using a trailing '\' has the same effect as the
quoting before the bug 63815 fix (the new lines are removed).

Another option I have seen used is:
CATALINA_OPTS="-Dfoo1=bar1"
CATALINA_OPTS="$CATALINA_OPTS -Dfoo2=bar2"
etc.

The fix for bug 63815 has been in place for over a year and this is the first
report I recall of issues with multi-line variables.

I don't see a simple way to filter out the newlines using /bin/sh so I am going
to resolve this as WONTFIX. The recommended workaround is to use one of the two
alternative approaches described above.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65240] Multi line CATALINA_OPTS is failing in with new catalina.sh

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65240

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Christopher Schultz <ch...@christopherschultz.net> ---
The origin of the quoted CATALINA_OPTS is bug #63815. I would recommend you
read-through that bug to see why we are quoting CATALINA_OPTS.

I'm curious about your use-case of needing a multi-line value in CATALINA_OPTS.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org