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

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