Skip to content
  • Hanna Reitz's avatar
    0d54a6fe
    block: Fix backing paths for filenames with colons · 0d54a6fe
    Hanna Reitz authored
    
    
    path_combine() naturally tries to preserve a protocol prefix. However,
    it recognizes such a prefix by scanning for the first colon; which is
    different from what path_has_protocol() does: There only is a protocol
    prefix if there is a colon before the first slash.
    
    A protocol prefix that is not recognized by path_has_protocol() is none,
    and should thus not be taken as one.
    
    Case in point, before this patch:
    $ ./qemu-img create -f qcow2 -b backing.qcow2 ./top:image.qcow2
    qemu-img: ./top:image.qcow2: Could not open './top:backing.qcow2':
        No such file or directory
    
    Afterwards:
    $ ./qemu-img create -f qcow2 -b backing.qcow2 ./top:image.qcow2
    qemu-img: ./top:image.qcow2: Could not open './backing.qcow2':
        No such file or directory
    
    Reported-by: default avataryangyang <yangyang@redhat.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-id: 20170522195217.12991-2-mreitz@redhat.com
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    0d54a6fe
    block: Fix backing paths for filenames with colons
    Hanna Reitz authored
    
    
    path_combine() naturally tries to preserve a protocol prefix. However,
    it recognizes such a prefix by scanning for the first colon; which is
    different from what path_has_protocol() does: There only is a protocol
    prefix if there is a colon before the first slash.
    
    A protocol prefix that is not recognized by path_has_protocol() is none,
    and should thus not be taken as one.
    
    Case in point, before this patch:
    $ ./qemu-img create -f qcow2 -b backing.qcow2 ./top:image.qcow2
    qemu-img: ./top:image.qcow2: Could not open './top:backing.qcow2':
        No such file or directory
    
    Afterwards:
    $ ./qemu-img create -f qcow2 -b backing.qcow2 ./top:image.qcow2
    qemu-img: ./top:image.qcow2: Could not open './backing.qcow2':
        No such file or directory
    
    Reported-by: default avataryangyang <yangyang@redhat.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-id: 20170522195217.12991-2-mreitz@redhat.com
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
Loading