Skip to content

Respect spaces in ARGS passed to systemd unit

Steve Traylen requested to merge straylen/lpadmincern:envs into master

Currently with a drop file setting of say

Environment=ARGS="--add *"

this calls lpadmincern '--add *'

Previously with the perl version this was accepted but in fact lpadmincern did nothing.

With the python version this quite correctly gives a parameter validation error.

From man systemd.service

Basic environment variable substitution is supported. Use "${FOO}" as part of a word, or as a word of its own, on the command line, in which case it will be replaced by the value of the environment variable including all whitespace it contains, resulting in a single argument. Use "$FOO" as a separate word on the command line, in which case it will be replaced by the value of the environment variable split at whitespace, resulting in zero or more arguments. For this type of expansion, quotes are respected when splitting into words, and afterwards removed.

It was worth coming to work today.

Edited by Steve Traylen

Merge request reports