Red Hat Bugzilla – Bug 980372
"hivex-commit" should fail with a relative path
Last modified: 2013-11-20 23:45:38 EST
+++ This bug was initially created as a clone of Bug #905322 +++ Description of problem: Command "hivex-commit" need a absolute path as its parameter, it's different with "hivex-open" which just need a relative path. "/WINDOWS/system32/config/software" is exist, and that folder is writable. it's like hivex-commit didn't correctly follow the link, its path is not start from "/sysroot/" Version-Release number of selected component (if applicable): ><fs> version major: 1 minor: 20 release: 1 extra: rhel=7,release=6.el7,libvirt How reproducible: 100% Steps to Reproduce: 1. launch libguestfs with a windows guest [root#] guestfish -a Win2003-32-hvm.raw ><fs> run ><fs> mount /dev/sda1 / 2. open a registry hive file with write model ><fs> hivex-open /WINDOWS/system32/config/software write:true 3. commit changes to the hive file with relative path, it's failed ><fs> hivex-commit /WINDOWS/system32/config/software libguestfs: error: hivex_commit: failed: No such file or directory 4. commit changes to the hive file with absolute path, it's passed ><fs> hivex-commit /sysroot/WINDOWS/system32/config/software Actual results: hivex-commit with relatived path failed Expected results: hivex-commit with relatived path can pass Additional info: --- Additional comment from RHEL Product and Program Management on 2013-01-29 02:27:34 EST --- Since this bug report was entered in bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release. --- Additional comment from Richard W.M. Jones on 2013-01-29 05:38:13 EST --- Fixed upstream in: https://github.com/libguestfs/libguestfs/commit/be4a3d77c42148731a977b68aab8b454372518d7
Sorry, may something wrong during my test. Actually it works, not a bug, please close it.
In fact there is a bug here. Test script. You'll need 'minimal' from https://github.com/libguestfs/hivex/blob/master/images/minimal and note that you have to uncomment only *one* of the three hivex-commit lines in the script. guestfish -x -N fs -m /dev/sda1 <<EOF upload /mnt/scratch/minimal /minimal hivex-open /minimal write:true #hivex-commit "" #hivex-commit "/minimal" hivex-commit "minimal" EOF The first case (NULL) should always succeed and it does. The second case (absolute path "/minimal") should succeed and it does. The third case (relative path "minimal") should fail because relative paths shouldn't be allowed. It doesn't fail, so that is a bug.
Upstream fix: https://github.com/libguestfs/libguestfs/commit/c8f0a2eb76a39a009e0591f73e5249f3bcfc4ee8
Verified with libguestfs-1.20.11-1.el6.x86_64 Test according to #C2 (1) successed guestfish -x -N fs -m /dev/sda1 <<EOF upload /mnt/scratch/minimal /minimal hivex-open /minimal write:true hivex-commit "" #hivex-commit "/minimal" #hivex-commit "minimal" EOF (2) successed guestfish -x -N fs -m /dev/sda1 <<EOF upload /mnt/scratch/minimal /minimal hivex-open /minimal write:true #hivex-commit "" hivex-commit "/minimal" #hivex-commit "minimal" EOF (3) libguestfs: error: hivex_commit: do_hivex_commit: path must start with a / character guestfish -x -N fs -m /dev/sda1 <<EOF upload /mnt/scratch/minimal /minimal hivex-open /minimal write:true #hivex-commit "" #hivex-commit "/minimal" hivex-commit "minimal" EOF So change the status to verified
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2013-1536.html