all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com, Wolfgang Bumiller <w.bumiller@proxmox.com>
Subject: Re: [pbs-devel] [RFC proxmox] support quoted strings in property strings
Date: Thu, 17 Feb 2022 09:58:03 +0100	[thread overview]
Message-ID: <b530766a-5af2-aae1-d44e-581bbde4b803@proxmox.com> (raw)
In-Reply-To: <20220216133917.101133-1-w.bumiller@proxmox.com>

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?

> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
> This is mostly a reaction to Hannes' maintenance mode series.
> I think it would make more sense to improve our "property string
> specification" (as much as there is one :P) to support quoted strings.
> This way we can avoid the url encoding mess.
> 
> We could also do this in PVE (which would be particularly useful if we
> want to allow adding notes to net/disk devices).
> AFAICT the only property strings containing string values which would
> in *theory* allow quotes in the beginning wouldn't work with them in
> *practice*, (eg. the 'path' in a container's mount point, or an 'mdev'
> in a VM's hostpci entry?)
> 
>  proxmox-schema/src/lib.rs             |   2 +
>  proxmox-schema/src/property_string.rs | 163 ++++++++++++++++++++++++++
>  proxmox-schema/src/schema.rs          |  25 ++--
>  3 files changed, 177 insertions(+), 13 deletions(-)
>  create mode 100644 proxmox-schema/src/property_string.rs
> 
> diff --git a/proxmox-schema/src/lib.rs b/proxmox-schema/src/lib.rs
> index 4e98443..13b0739 100644
> --- a/proxmox-schema/src/lib.rs
> +++ b/proxmox-schema/src/lib.rs
> @@ -19,6 +19,8 @@ pub use const_regex::ConstRegexPattern;
>  pub mod de;
>  pub mod format;
>  
> +pub(crate) mod property_string;
> +
>  mod schema;
>  pub use schema::*;
>  
> diff --git a/proxmox-schema/src/property_string.rs b/proxmox-schema/src/property_string.rs
> new file mode 100644
> index 0000000..a40c1ca
> --- /dev/null
> +++ b/proxmox-schema/src/property_string.rs
> @@ -0,0 +1,163 @@
> +//! Property string parsing
> +//! This may at some point also get a proper direkt `Serializer`/`Deserializer` for property
> +//! strings.
> +
> +use std::borrow::Cow;
> +use std::mem;
> +
> +use anyhow::{bail, format_err, Error};
> +
> +/// 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?

> +/// If the value does not require stripping backslash escapes it will be borrowed, otherwise an
> +/// owned `String` will be returned.
> +pub struct PropertyIterator<'a> {
> +    data: &'a str,
> +}
> +




  reply	other threads:[~2022-02-17  9:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 13:39 [pve-devel] " Wolfgang Bumiller
2022-02-16 13:39 ` [pbs-devel] " Wolfgang Bumiller
2022-02-17  8:58 ` Fabian Ebner [this message]
2022-02-17  9:47   ` Wolfgang Bumiller
2022-02-17 11:13 ` [pve-devel] applied: " Thomas Lamprecht
2022-02-17 11:13   ` [pbs-devel] applied: " Thomas Lamprecht
2022-02-18  8:02 ` [pbs-devel] " Fabian Ebner
2022-02-18  8:13 Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b530766a-5af2-aae1-d44e-581bbde4b803@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=w.bumiller@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal