Bug 1477623
Summary: | Running file API on a special chardev may hang forever | ||||||
---|---|---|---|---|---|---|---|
Product: | [Community] Virtualization Tools | Reporter: | mathieu.tarral | ||||
Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> | ||||
Status: | CLOSED UPSTREAM | QA Contact: | |||||
Severity: | low | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | unspecified | CC: | ptoscano, rbalakri | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2017-08-08 17:27:09 UTC | 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: | |||||||
Attachments: |
|
Description
mathieu.tarral
2017-08-02 13:37:30 UTC
Reproducer: $ virt-builder fedora-26 $ guestfish -a fedora-26.img -i ><fs> mknod-c 0777 5 1 /dev/console ><fs> ll /dev total 0 drwxr-xr-x. 2 root root 21 Aug 2 13:41 . dr-xr-xr-x. 17 root root 224 Jul 19 14:39 .. crwxr-xr-x 1 root root 5, 1 Aug 2 13:41 console ><fs> file /dev/console [hangs here] Reproducible for me in libguestfs-1.36.5-1.fc26.x86_64 Also reproducible with libguestfs from git (with the OCaml API). Grrr I thought we'd fixed this bug years ago :-( *** Bug 1477665 has been marked as a duplicate of this bug. *** These two bugs are different aspects of the same problem. The guestfs_file API filename parameter is marked as Dev_or_Path: https://github.com/libguestfs/libguestfs/blob/c355b744bf22a3abc9fd289357a87c804faabc38/generator/actions_core.ml#L2104 This is supposed to allow you to do g.file ("/dev/sda1") and have it do the obvious thing. This is implemented by looking at the appliance device node if we think the parameter corresponds to a device. However the stub code in the daemon only checks if the path begins with "/dev/", which is not very clever. It should really check if the path corresponds to the name of an appliance block device (possibly untranslated). In any case I wouldn't try using guestfs_file on /dev/ paths. Even if we fix this problem it won't return any useful information because the implementation simple returns fixed strings like "block device" etc for anything which is a block device etc. It's probably better to use g.statns() first and only call g.file() for regular files which don't begin with "/dev/". That was a bit harder than I thought it was going to be, but patches posted: https://www.redhat.com/archives/libguestfs/2017-August/msg00038.html This is fixed upstream in libguestfs >= 1.37.21. |