mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0061-inspect-fix-inspection-of-partition-less-devices-RHB.patch

df3bb2
From 751afe91e07286effcc9af81c5d29b19cfa278ec Mon Sep 17 00:00:00 2001
df3bb2
From: Pino Toscano <ptoscano@redhat.com>
df3bb2
Date: Mon, 14 Jan 2019 17:07:45 +0100
df3bb2
Subject: [PATCH] inspect: fix inspection of partition-less devices
df3bb2
 (RHBZ#1661038)
df3bb2
df3bb2
When parsing "xdev"-kind devices, do not assume that the partition
df3bb2
number can be converted to integer: re_xdev accepts an empty part of the
df3bb2
partition number, so just handle as it is, as string.
df3bb2
df3bb2
This fixes a regression due to the conversion of the inspection code to
df3bb2
OCaml, as the old C version did not have this issue.
df3bb2
df3bb2
(cherry picked from commit cf6b527824b2a8dc6e8bc65e38ebdceb227e6db1)
df3bb2
---
df3bb2
 daemon/inspect_fs_unix_fstab.ml | 6 +++---
df3bb2
 1 file changed, 3 insertions(+), 3 deletions(-)
df3bb2
df3bb2
diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml
df3bb2
index 170440d2c..3428ad75c 100644
df3bb2
--- a/daemon/inspect_fs_unix_fstab.ml
df3bb2
+++ b/daemon/inspect_fs_unix_fstab.ml
df3bb2
@@ -347,7 +347,7 @@ and resolve_fstab_device spec md_map os_type =
df3bb2
     debug_matching "xdev";
df3bb2
     let typ = PCRE.sub 1
df3bb2
     and disk = PCRE.sub 2
df3bb2
-    and part = int_of_string (PCRE.sub 3) in
df3bb2
+    and part = PCRE.sub 3 in
df3bb2
     resolve_xdev typ disk part default
df3bb2
   )
df3bb2
 
df3bb2
@@ -464,7 +464,7 @@ and resolve_fstab_device spec md_map os_type =
df3bb2
     debug_matching "Hurd";
df3bb2
     let typ = PCRE.sub 1
df3bb2
     and disk = int_of_string (PCRE.sub 2)
df3bb2
-    and part = int_of_string (PCRE.sub 3) in
df3bb2
+    and part = PCRE.sub 3 in
df3bb2
 
df3bb2
     (* Hurd disk devices are like /dev/hdNsM, where hdN is the
df3bb2
      * N-th disk and M is the M-th partition on that disk.
df3bb2
@@ -501,7 +501,7 @@ and resolve_xdev typ disk part default =
df3bb2
   let i = drive_index disk in
df3bb2
   if i >= 0 && i < Array.length devices then (
df3bb2
     let dev = Array.get devices i in
df3bb2
-    let dev = dev ^ string_of_int part in
df3bb2
+    let dev = dev ^ part in
df3bb2
     if is_partition dev then
df3bb2
       Mountable.of_device dev
df3bb2
     else
df3bb2
-- 
df3bb2
2.21.0
df3bb2