On Mon, Sep 23, 2024 at 11:03:08AM -0500, Eric Blake wrote: > On Sun, Sep 22, 2024 at 08:51:22PM GMT, Richard W.M. Jones wrote: > > On Thu, Mar 28, 2024 at 02:13:42PM +0000, Richard W.M. Jones wrote: > > > On Thu, Mar 28, 2024 at 03:06:03PM +0100, Thomas Huth wrote: > > > > Since version 2.66, glib has useful URI parsing functions, too. > > > > Use those instead of the QEMU-internal ones to be finally able > > > > to get rid of the latter. The g_uri_get_host() also takes care > > > > of removing the square brackets from IPv6 addresses, so we can > > > > drop that part of the QEMU code now, too. > > > > > > > > > > > > > - p = uri->path ? uri->path : ""; > > > > + p = g_uri_get_path(uri) ?: ""; > > > > if (p[0] == '/') { > > > > p++; > > > > } > > > > Looks ok, > > > > > > Reviewed-by: Richard W.M. Jones <rjo...@redhat.com> > > > > Or maybe not. This caused a regression in the nbdkit test suite (when > > we use qemu-img from 9.1). It seems the exportname part of the NBD > > URI gets munged: > > > > https://gitlab.com/qemu-project/qemu/-/issues/2584 > > To be more specific, it looks like > g_uri_get_path("./name//with//..//slashes") is getting munged to > "name/slashes". That is, glib is blindly assuming that ./ and XXX/../ > can be dropped, and // can be simplified to /, which may be true for > arbitrary file names but not true for abitrary URIs (since URIs have > application-specific semantics, which may not match path name > traversal semantics). Looks like we need to report a bug to glib, > and/or see if glib's URI functions have a flag for turning off this > unwanted munging.
The source code indicates it is doing some normalization based on this: https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4 With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|