[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: General question about parsing an rbd filename
From: |
Markus Armbruster |
Subject: |
Re: General question about parsing an rbd filename |
Date: |
Fri, 09 Apr 2021 16:27:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Connor Kuehl <ckuehl@redhat.com> writes:
> Hi,
>
> block/rbd.c hints that:
>
>> * Configuration values containing :, @, or = can be escaped with a
>> * leading "\".
>
> Right now, much of the parsing code will allow anyone to escape
> _anything_ so long as it's preceded by '\'.
>
> Is this the intended behavior? Or should the parser be updated to
> allow escaping only certain sequences.
I can't answer this question, but perhaps I can get us a bit closer to
an answer.
The commend you quoted in part is about "rbd:" pseudo-filenames.
By "parsing code", you probably mean qemu_rbd_parse_filename(). It uses
qemu_rbd_next_tok() to split off one part after the other, stopping at a
special delimiter character, and qemu_rbd_unescape() to unescape most,
but not all parts.
Both treat '\' followed by a character other than '\0' specially.
qemu_rbd_next_tok() doesn't stop at an escaped delimiter character.
qemu_rbd_unescape() unescapes escaped characters.
I believe the comment you quoted is basically trying to say "to use a
character that would normally be a delimiter, escape it with '\'". It
doesn't say these are the only characters you may escape.
Not unescaping some parts feels iffy to me.