Pino Toscano
2019-Jan-14 16:29 UTC
[Libguestfs] [PATCH] inspect: fix inspection of partition-less devices (RHBZ#1661038)
When parsing "xdev"-kind devices, do not assume that the partition number can be converted to integer: re_xdev accepts an empty part of the partition number, so just handle as it is, as string. This fixes a regression due to the conversion of the inspection code to OCaml, as the old C version did not have this issue. --- daemon/inspect_fs_unix_fstab.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml index 9f9478144..02956ae94 100644 --- a/daemon/inspect_fs_unix_fstab.ml +++ b/daemon/inspect_fs_unix_fstab.ml @@ -350,7 +350,7 @@ and resolve_fstab_device spec md_map os_type debug_matching "xdev"; let typ = PCRE.sub 1 and disk = PCRE.sub 2 - and part = int_of_string (PCRE.sub 3) in + and part = PCRE.sub 3 in resolve_xdev typ disk part default ) @@ -467,7 +467,7 @@ and resolve_fstab_device spec md_map os_type debug_matching "Hurd"; let typ = PCRE.sub 1 and disk = int_of_string (PCRE.sub 2) - and part = int_of_string (PCRE.sub 3) in + and part = PCRE.sub 3 in (* Hurd disk devices are like /dev/hdNsM, where hdN is the * N-th disk and M is the M-th partition on that disk. @@ -504,7 +504,7 @@ and resolve_xdev typ disk part default let i = drive_index disk in if i >= 0 && i < Array.length devices then ( let dev = Array.get devices i in - let dev = dev ^ string_of_int part in + let dev = dev ^ part in if is_partition dev then Mountable.of_device dev else -- 2.20.1
Richard W.M. Jones
2019-Jan-14 16:35 UTC
Re: [Libguestfs] [PATCH] inspect: fix inspection of partition-less devices (RHBZ#1661038)
On Mon, Jan 14, 2019 at 05:29:41PM +0100, Pino Toscano wrote:> When parsing "xdev"-kind devices, do not assume that the partition > number can be converted to integer: re_xdev accepts an empty part of the > partition number, so just handle as it is, as string. > > This fixes a regression due to the conversion of the inspection code to > OCaml, as the old C version did not have this issue. > --- > daemon/inspect_fs_unix_fstab.ml | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml > index 9f9478144..02956ae94 100644 > --- a/daemon/inspect_fs_unix_fstab.ml > +++ b/daemon/inspect_fs_unix_fstab.ml > @@ -350,7 +350,7 @@ and resolve_fstab_device spec md_map os_type > debug_matching "xdev"; > let typ = PCRE.sub 1 > and disk = PCRE.sub 2 > - and part = int_of_string (PCRE.sub 3) in > + and part = PCRE.sub 3 in > resolve_xdev typ disk part default > ) > > @@ -467,7 +467,7 @@ and resolve_fstab_device spec md_map os_type > debug_matching "Hurd"; > let typ = PCRE.sub 1 > and disk = int_of_string (PCRE.sub 2) > - and part = int_of_string (PCRE.sub 3) in > + and part = PCRE.sub 3 in > > (* Hurd disk devices are like /dev/hdNsM, where hdN is the > * N-th disk and M is the M-th partition on that disk. > @@ -504,7 +504,7 @@ and resolve_xdev typ disk part default > let i = drive_index disk in > if i >= 0 && i < Array.length devices then ( > let dev = Array.get devices i in > - let dev = dev ^ string_of_int part in > + let dev = dev ^ part in > if is_partition dev then > Mountable.of_device dev > elseMakes sense, ACK. Please push this soon so we get it in 1.40. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Apparently Analagous Threads
- [PATCH v12 09/11] daemon: Implement inspection of Linux and other Unix-like operating systems.
- [PATCH v11 08/10] daemon: Implement inspection of Linux and other Unix-like operating systems.
- [PATCH] daemon: consider /etc/mdadm/mdadm.conf while inspecting mountpoints.
- [PATCH] daemon: inspect: ignore fstab devs that cannot be resolved (RHBZ#1608131)
- [PATCH v2 3/5] daemon: move Lvm.lv_canonical to new Lvm_utils module