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.

(cherry picked from commit cf6b527824)
This commit is contained in:
Pino Toscano
2019-01-14 17:07:45 +01:00
parent 31af609ecc
commit 751afe91e0

View File

@@ -347,7 +347,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
)
@@ -464,7 +464,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.
@@ -501,7 +501,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