[pbs-devel] [RFC proxmox] support quoted strings in property strings
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Feb 17 10:47:48 CET 2022
On Thu, Feb 17, 2022 at 09:58:03AM +0100, Fabian Ebner wrote:
> Am 16.02.22 um 14:39 schrieb Wolfgang Bumiller:
> > This allows free form text to exist within property strings,
> > quoted, like:
> > key="A value with \"quotes, also commas",key2=value2
> > or also:
> > "the value for a default_key",key2=value2
> >
> > And drop ';' as a key=value separator since those are meant
> > for arrays inside property strings...
> >
>
> Isn't that backwards-incompatible?
Technically yes, but currently we aren't using it, it's not compatible
with pve and it's also not documented, so chances are nobody manually
wrote this in a config file yet.
In pve we for instance have
features: mount=ext4;ntfs;foo
in containers and
cpu: flags=+FOO;-BAR
in VMs
and it was initially meant to work the same in pbs...
I really do prefer "breaking" this ASAP.
> > +/// Iterate over the `key=value` pairs of a property string.
> > +///
> > +/// Note, that the `key` may be optional when the schema defines a "default" key.
>
> Nit: But the iterator does not use the schema. Shouldn't the comment
> here rather just describe the behavior of the iterator?
It doesn't, but it's meant specifically for property strings and the
iterator is not exposed to the public right now. Iow. it's currently a
parser-internal detail.
(A reason to keep it internal is also that the de-quoting happening is
very limited (on purpose), and exposing it might give people the idea of
adding things like `\xXY` or `\U0ABC` support to the string parser, too.
But if someone needs that, I'd rather look for an existing parse/quote
crate first before adding more custom code... ;-) )
(In fact... it may even be nicer code-wise if the default key was itself
stored in the iterator... not sure... but I have some serde
De/Serializer WIP/POC code for property strings to avoid the
serde_json::Value intermediate step for those (particularly for the
*verify* case))
More information about the pbs-devel
mailing list