qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* General question about parsing an rbd filename
@ 2021-04-01 21:10 Connor Kuehl
  2021-04-09 14:27 ` Markus Armbruster
  0 siblings, 1 reply; 3+ messages in thread
From: Connor Kuehl @ 2021-04-01 21:10 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, dillaman, qemu-devel, mreitz

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.

Just curious.

Thanks,

Connor



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: General question about parsing an rbd filename
  2021-04-01 21:10 General question about parsing an rbd filename Connor Kuehl
@ 2021-04-09 14:27 ` Markus Armbruster
  2021-04-09 17:06   ` Connor Kuehl
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Armbruster @ 2021-04-09 14:27 UTC (permalink / raw)
  To: Connor Kuehl; +Cc: kwolf, dillaman, qemu-devel, qemu-block, mreitz

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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: General question about parsing an rbd filename
  2021-04-09 14:27 ` Markus Armbruster
@ 2021-04-09 17:06   ` Connor Kuehl
  0 siblings, 0 replies; 3+ messages in thread
From: Connor Kuehl @ 2021-04-09 17:06 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: kwolf, dillaman, qemu-devel, qemu-block, mreitz

On 4/9/21 9:27 AM, Markus Armbruster wrote:
> Connor Kuehl <ckuehl@redhat.com> writes:
>> 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.

I agree with your interpretation here.

> Not unescaping some parts feels iffy to me.

I wonder if my reading of it placed too much emphasis on the 
"Configuration values" part of it, which I understand to be the optional 
key,value pairs that come after the image name.

Thank you,

Connor



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-09 17:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 21:10 General question about parsing an rbd filename Connor Kuehl
2021-04-09 14:27 ` Markus Armbruster
2021-04-09 17:06   ` Connor Kuehl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).