Description of problem: virt-edit creates a new file when it is used. Unfortunately this means that the old file's permissions, SELinux context etc are lost. virt-edit should preserve all of this by copying it from the old file to the new file. Version-Release number of selected component (if applicable): 1.17.5 How reproducible: 100% Steps to Reproduce: This reproducer uses the phony Fedora test image from libguestfs, but any Linux guest image would do. $ cd libguestfs $ cp tests/guests/fedora.img /tmp $ ./run ./fish/guestfish -a /tmp/fedora.img -i \ write /test "hello" : chmod 0600 /test : ll /test $ ./run ./edit/virt-edit -a /tmp/fedora.img /test -e 's/hello/goodbye/' $ ./run ./fish/guestfish -a /tmp/fedora.img -i \ ll /test : cat /test : rm /test Actual results: The commands above print: -rw------- 1 root root 5 Feb 8 17:14 /sysroot/test -rw-r--r-- 1 root root 7 Feb 8 17:15 /sysroot/test goodbye which shows that the permissions have changed. Expected results: Permissions, SELinux context etc should be preserved. Additional info:
Are there other tools which don't and should preserve permissions?
The answer to comment 1 appears to be 'no'. Patch posted upstream which preserves file mode, UID, GID and SELinux context: https://www.redhat.com/archives/libguestfs/2012-February/msg00033.html
This will be fixed upstream in 1.17.6.