Red Hat Bugzilla – Bug 633174
some guestfish sub commands can not handle special files properly
Last modified: 2015-09-27 22:23:48 EDT
Still exists in libguestfs-1.2.7-1.24.el6, so clone to RHEL6 to ensure it get fixed in RHEL 6.1. +++ This bug was initially created as a clone of Bug #582484 +++ Description of problem: 1. guestfish "file" command can not handle character special files properly, it just hang when called againest a char special file. 2. guestfish "touch" command can not handle fifo special files properly, it also hang. These two commands can work for other special devices like block special file. Version-Release number of selected component (if applicable): libguestfs-1.0.85-1.fc12.3.x86_64 And also the lastest git version How reproducible: 100% Steps to Reproduce: 1. Run guestfish, add an img containing some char/block/fifo special files 2. Run and mount the partition 3. "file /path_to_char-dev-file" , it will hang the guestfish shell. 4. Repeat step 1,2, then run "touch /path_to_fifo-dev-file", it will hang. 5. ll,stat commands works fine for these special files Actual results: guestfish hang Expected results: command should return proper value Additional info: check logs in the attachment: guestfish-file-error01.log guestfish-touch-error02.log --- Additional comment from pcao@redhat.com on 2010-04-15 02:39:34 EDT --- Created attachment 406688 [details] log for file command --- Additional comment from pcao@redhat.com on 2010-04-15 02:40:03 EDT --- Created attachment 406689 [details] log for touch command --- Additional comment from rjones@redhat.com on 2010-04-15 04:24:22 EDT --- I'll have a look at this when I get back from holiday. --- Additional comment from rjones@redhat.com on 2010-06-04 10:37:55 EDT --- Patches posted upstream to fix the issues with the touch and file commands. https://www.redhat.com/archives/libguestfs/2010-June/msg00050.html --- Additional comment from rjones@redhat.com on 2010-06-08 09:32:57 EDT --- This commit: http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=4df593496e116dfb635731c058b7627e81fc179c breaks OS detection, since /dev/VG/LV is a symbolic link to ../dm-NN. Reopening this bug. --- Additional comment from rjones@redhat.com on 2010-06-08 11:08:02 EDT --- Second patch posted: https://www.redhat.com/archives/libguestfs/2010-June/msg00068.html --- Additional comment from rjones@redhat.com on 2010-06-08 13:01:39 EDT --- Patch ACKed upstream: http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=ba39ced8804765705f4c61a92db0fddb8d672c7d
Will be fixed by the rebase (bug 613593).
Fixed by the rebase.
Test steps: 1. Run guestfish, add image, run and mount. 2. Use "mkfifo 0644 /tmp/fifo-file" to create a FIFO file. 3. Verify the file created correctly via "ll /tmp/fifo-file". 4. Run "touch /tmp/fifo-file". 5. Rerun step 1. 6. Use "mknod-c 0644 1 6 /tmp/char-file" to create a character file. 7. Verify the file created correctly via "ll /tmp/char-file". 8. Run "file /tmp/char-file". Could reproduce the bug with: libguestfs-1.2.7-1.24.el6 At step 4, the "touch" command hangs there. At step 8, the "file" comamnd reports "writable, no read permission" though "ll" shows there's read permission. Verity this bug with: libguestfs-1.7.17-10.el6 At step 4, the "touch" command failed with error message as below: libguestfs: error: touch: /tmp/fifo-file: touch can only be used on a regular files. At step 8, the "file" command returned right file type as below: character device According to the results above, move to VERIFIED.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Some guestfish commands would hang when applied to non-regular files. This had some security implications in that a guest could replace regular configuration files with, for example, character devices, and cause virt-inspector and other programs to hang. guestfish commands have been modified and can now handle non-regular files. Additionally, the virt-inspector has been rewritten as virt-inspector2, which is both more powerful, and more careful about untrusted files from the guest.
Small change made to technical note.
Technical note updated. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. Diffed Contents: @@ -1,3 +1,3 @@ Some guestfish commands would hang when applied to non-regular files. This had some security implications in that a guest could replace regular configuration files with, for example, character devices, and cause virt-inspector and other programs to hang. guestfish commands have been modified and can now handle non-regular files. -Additionally, the virt-inspector has been rewritten as virt-inspector2, which is both more powerful, and more careful about untrusted files from the guest.+Additionally, virt-inspector has been rewritten as virt-inspector2, which is both more powerful, and more careful about untrusted files from the guest.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2011-0586.html