Bug 1232477

Summary: guestfs_add_drive_opts incorrectly quotes query parameters
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ptoscano
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Richard W.M. Jones 2015-06-16 20:31:57 UTC
Description of problem:

If you use guestfs_add_drive_opts, and the first parameter (the path)
contains a query parameter, it is quoted:

$ guestfish -x -v add "/?foo=bar" protocol:https server:test.example.com readonly:true : run 
...
libguestfs: command: run: qemu-img
libguestfs: command: run: \ create
libguestfs: command: run: \ -f qcow2
libguestfs: command: run: \ -o backing_file=https://test.example.com/%3Ffoo=bar
libguestfs: command: run: \ /tmp/libguestfsXUkwGI/overlay1

Note that the ? is quoted as %3F.

This may or may not be a bug, but it means there is no way to provide
a ?query in a URL when accessing a curl resource.

Version-Release number of selected component (if applicable):

libguestfs-1.29.46-1.fc23.x86_64

How reproducible:

100%

Steps to Reproduce:
1. See above.

Comment 1 Pino Toscano 2015-11-09 17:50:08 UTC
Isn't this somehow duplicated of bug #1092583, whose resolution (passing the query string separately, and reusing it for the protocols using it) would fix this bug as well?

Comment 2 Richard W.M. Jones 2015-11-10 10:52:40 UTC
If you mean we should add an extra parameter to add_drive_opts
to hold the query string, analogous to the secret/password parameter,
then yes I think that may be the right solution.