[systemd-devel] [PATCH] Correctly parse commented multiline variables
mvyskocil at suse.cz
Mon Feb 4 04:53:24 PST 2013
> can you check if it works with the following test case?
> For me it doesn't, and I think there must be a bug.
sorry for a responding on my initial email, but for some reason your
response did not appear in my mailbox. Anyway your test have raised
an interesting problem - the load_env_file does not parse a variable
definition like shell* do. It considers everything behind quotes as a
variable content and continuation character does not matter.
will be properly recognized by shell, but not by systemd. On the other
hand, it will accept definitions like FOO=one two, which has a different
meaning in a shell, so must be quoted. Therefor we shall define
systemd's behavior and of course how much close systemd should mimic
I'd say systemd can ignore quoting and be a bit stricter than a
shell, so accepts only lines ends on "\\\n" as a continuation and in
this mode accept #comments to be a part of a definition
The question is what to do with a definitions ends on a \, followed by
will result in "this #is commented", but this is probably not what
people will expect and it behaves differently than a shell. We might
have a rule definition can't end on a comment, even this sounds a bit
nasty to me.
This is probably the reason, where shell syntax make it clear
*I've no idea if there are any differences in variable definitions, but
I use dash as the reference one. So just s/shell/dash/
On Fri, Feb 01, 2013 at 02:47:24PM +0100, Michal Vyskocil wrote:
> Buffer c must be freeed when code detects a comment or empty string after
> a strip. Otherwise no other variable definitions will be loaded.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: Digital signature
More information about the systemd-devel