Escaped and quoted arguments are treated differently by the launch script depending on how it is invoked
A spring-boot application treats the escaping of arguments differently at startup as root or as user if it is not using the start-stop-daemon.
The issue was introduced with commit 4c65e5e704cfab3160ea7276304f307c993bddf9 by using printf for arguments if running as root or just passing the arguments if running as user.
How to reproduce:
- Create a spring-boot-application with a config file
- Add RUN_ARGS with single quote, like
RUN_ARGS='--spring.datasource.password=my$password$with$dollars'
- Start the application as user will add the RUN_ARGS correct, even for multiline values
- Start the application as root will not escape the value.
Solutions to make it predictable
- Not using the printf (may be a bad solution? )
- Using printf in all cases as it is currently done for root
- Using printf in all cases and reflect single quote escaping defined in the .conf file.
Additional information I was not able to test against the start-stop-daemon. It might by that it is also ignoring the single quote arguments given in the .conf file.
Update for peoples who may have the same issue:
Simple workaround:
- Add an
application.propertiesanywhere near your deployment path - Add following config to the run args
--spring.config.additional-location=./path/to/folder/
Documentation about this config property: 2.3. Application Property Files
To reduce the risk of regression, we should tackle #20335 before fixing this issue.