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

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