Fix inspection with duplicated root mountpoint resolves: RHEL-90170 Remove zfs-fuse (not used in RHEL) Remove file-devel dependency. Fix RHEL gating tests - These would always fail because libvirt doesn't start up after being installed. You would see errors like: libguestfs: opening libvirt handle: URI = qemu:///system, auth = default+wrapper, flags = 0 libvirt: XML-RPC error : Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory libguestfs: error: could not connect to libvirt (URI = qemu:///system): Failed to connect socket to '/var/run/libvirt/virtqemud-sock': No such file or directory [code=38 int1=2] (cherry picked from Fedora commit a1eed9c04c9e64cf24bc83a0da2cd6b05f7400c3)
532 lines
22 KiB
Diff
532 lines
22 KiB
Diff
From f9edfc9a18eec134a38872166bb2e3dac51a8d18 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Sun, 11 May 2025 21:21:56 +0100
|
|
Subject: [PATCH] Update common submodule
|
|
|
|
This pulls in the commits below, requiring us to replace all uses of
|
|
String.is_prefix and String.is_suffix.
|
|
|
|
Mostly done with Perl like this, and carefully checked by hand
|
|
afterwards since this doesn't get everything right:
|
|
|
|
$ perl -pi.bak -e 's/String.is_prefix ([^[:space:]\)]+) ([^[:space:]\)]+)/String.starts_with \2 \1/g' -- `git ls-files`
|
|
|
|
Richard W.M. Jones (3):
|
|
mlstdutils: Fix comment that still referred to the old function names
|
|
mldrivers: Link to gettext-stub if ocaml-gettext is enabled
|
|
mlstdutils: Rename String.is_prefix -> starts_with, is_suffix -> ends_with
|
|
---
|
|
common | 2 +-
|
|
daemon/cryptsetup.ml | 2 +-
|
|
daemon/devsparts.ml | 18 +++++++++---------
|
|
daemon/findfs.ml | 4 ++--
|
|
daemon/inspect_fs_unix.ml | 10 +++++-----
|
|
daemon/inspect_fs_unix_fstab.ml | 30 +++++++++++++++---------------
|
|
daemon/inspect_fs_windows.ml | 8 ++++----
|
|
daemon/ldm.ml | 2 +-
|
|
daemon/listfs.ml | 8 ++++----
|
|
daemon/md.ml | 2 +-
|
|
daemon/mount_utils.ml | 4 ++--
|
|
daemon/sfdisk.ml | 8 ++++----
|
|
daemon/utils.ml | 6 +++---
|
|
generator/daemon.ml | 2 +-
|
|
14 files changed, 53 insertions(+), 53 deletions(-)
|
|
|
|
Submodule common 3a05f1a7a..d4a81e9dd:
|
|
diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml
|
|
index 39b5bc9..4850a55 100644
|
|
--- a/common/mlstdutils/std_utils.ml
|
|
+++ b/common/mlstdutils/std_utils.ml
|
|
@@ -214,11 +214,11 @@ module String = struct
|
|
Bytes.unsafe_set b 0 (Char.uppercase_ascii (Bytes.unsafe_get b 0));
|
|
Bytes.to_string b
|
|
|
|
- let is_prefix str prefix =
|
|
+ let starts_with ~prefix str =
|
|
let n = length prefix in
|
|
length str >= n && sub str 0 n = prefix
|
|
|
|
- let is_suffix str suffix =
|
|
+ let ends_with ~suffix str =
|
|
let sufflen = length suffix
|
|
and len = length str in
|
|
len >= sufflen && sub str (len - sufflen) sufflen = suffix
|
|
@@ -824,7 +824,7 @@ let unix_like = function
|
|
| "hurd"
|
|
| "linux"
|
|
| "minix" -> true
|
|
- | typ when String.is_suffix typ "bsd" -> true
|
|
+ | typ when String.ends_with "bsd" typ -> true
|
|
| _ -> false
|
|
|
|
(** Return the last part of a string, after the specified separator. *)
|
|
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli
|
|
index 04c780a..fe6bf1a 100644
|
|
--- a/common/mlstdutils/std_utils.mli
|
|
+++ b/common/mlstdutils/std_utils.mli
|
|
@@ -71,7 +71,7 @@ module List : sig
|
|
[f] returns false.
|
|
|
|
For any list [xs] and function [f],
|
|
- [xs = takewhile f xs @ dropwhile f xs] *)
|
|
+ [xs = take_while f xs @ drop_while f xs] *)
|
|
|
|
val take : int -> 'a list -> 'a list
|
|
(** [take n xs] returns the first [n] elements of [xs]. If [xs] is
|
|
@@ -236,10 +236,10 @@ module String : sig
|
|
val uppercase_ascii : string -> string
|
|
val capitalize_ascii : string -> string
|
|
|
|
- val is_prefix : string -> string -> bool
|
|
- (** [is_prefix str prefix] returns true if [prefix] is a prefix of [str]. *)
|
|
- val is_suffix : string -> string -> bool
|
|
- (** [is_suffix str suffix] returns true if [suffix] is a suffix of [str]. *)
|
|
+ val starts_with : prefix:string -> string -> bool
|
|
+ (** Return true if [prefix] is a prefix of [str]. *)
|
|
+ val ends_with : suffix:string -> string -> bool
|
|
+ (** Return true if [suffix] is a suffix of [str]. *)
|
|
val find : string -> string -> int
|
|
(** [find str sub] searches for [sub] as a substring of [str]. If
|
|
found it returns the index. If not found, it returns [-1]. *)
|
|
diff --git a/common/mlstdutils/std_utils_tests.ml b/common/mlstdutils/std_utils_tests.ml
|
|
index 10046bd..133c672 100644
|
|
--- a/common/mlstdutils/std_utils_tests.ml
|
|
+++ b/common/mlstdutils/std_utils_tests.ml
|
|
@@ -87,21 +87,23 @@ let () =
|
|
assert_bool "Char.mem" (not (Char.mem 'd' "abc"));
|
|
assert_bool "Char.mem" (not (Char.mem 'a' ""))
|
|
|
|
-(* Test Std_utils.String.is_prefix. *)
|
|
+(* Test Std_utils.String.starts_with. *)
|
|
let () =
|
|
- assert_bool "String.is_prefix,," (String.is_prefix "" "");
|
|
- assert_bool "String.is_prefix,foo," (String.is_prefix "foo" "");
|
|
- assert_bool "String.is_prefix,foo,foo" (String.is_prefix "foo" "foo");
|
|
- assert_bool "String.is_prefix,foo123,foo" (String.is_prefix "foo123" "foo");
|
|
- assert_bool "not (String.is_prefix,,foo" (not (String.is_prefix "" "foo"))
|
|
+ assert_bool "String.starts_with,," (String.starts_with "" "");
|
|
+ assert_bool "String.starts_with,foo," (String.starts_with "" "foo");
|
|
+ assert_bool "String.starts_with,foo,foo" (String.starts_with "foo" "foo");
|
|
+ assert_bool "String.starts_with,foo123,foo"
|
|
+ (String.starts_with "foo" "foo123");
|
|
+ assert_bool "not (String.starts_with,,foo"
|
|
+ (not (String.starts_with "foo" ""))
|
|
|
|
-(* Test Std_utils.String.is_suffix. *)
|
|
+(* Test Std_utils.String.ends_with. *)
|
|
let () =
|
|
- assert_bool "String.is_suffix,," (String.is_suffix "" "");
|
|
- assert_bool "String.is_suffix,foo," (String.is_suffix "foo" "");
|
|
- assert_bool "String.is_suffix,foo,foo" (String.is_suffix "foo" "foo");
|
|
- assert_bool "String.is_suffix,123foo,foo" (String.is_suffix "123foo" "foo");
|
|
- assert_bool "not String.is_suffix,,foo" (not (String.is_suffix "" "foo"))
|
|
+ assert_bool "String.ends_with,," (String.ends_with "" "");
|
|
+ assert_bool "String.ends_with,foo," (String.ends_with "" "foo");
|
|
+ assert_bool "String.ends_with,foo,foo" (String.ends_with "foo" "foo");
|
|
+ assert_bool "String.ends_with,123foo,foo" (String.ends_with "foo" "123foo");
|
|
+ assert_bool "not String.ends_with,,foo" (not (String.ends_with "foo" ""))
|
|
|
|
(* Test Std_utils.String.find. *)
|
|
let () =
|
|
diff --git a/daemon/cryptsetup.ml b/daemon/cryptsetup.ml
|
|
index 9c0149b48..6f677aef0 100644
|
|
--- a/daemon/cryptsetup.ml
|
|
+++ b/daemon/cryptsetup.ml
|
|
@@ -63,7 +63,7 @@ let cryptsetup_open ?(readonly = false) ?crypttype ?cipher device key mapname =
|
|
|
|
let cryptsetup_close device =
|
|
(* Must be /dev/mapper/... *)
|
|
- if not (String.is_prefix device "/dev/mapper/") then
|
|
+ if not (String.starts_with "/dev/mapper/" device) then
|
|
failwithf "%s: you must call this on the /dev/mapper device created by cryptsetup-open" device;
|
|
|
|
let mapname = String.sub device 12 (String.length device - 12) in
|
|
diff --git a/daemon/devsparts.ml b/daemon/devsparts.ml
|
|
index 639e163d4..6b45ebc8e 100644
|
|
--- a/daemon/devsparts.ml
|
|
+++ b/daemon/devsparts.ml
|
|
@@ -38,18 +38,18 @@ let map_block_devices f =
|
|
fun file ->
|
|
let dev = Unix_utils.Realpath.realpath (sprintf "%s/%s" path file) in
|
|
(* Ignore non-/dev devices, and return without /dev/ prefix. *)
|
|
- if String.is_prefix dev "/dev/" then
|
|
+ if String.starts_with "/dev/" dev then
|
|
Some (String.sub dev 5 (String.length dev - 5))
|
|
else
|
|
None
|
|
) devs in
|
|
let devs = List.filter (
|
|
fun dev ->
|
|
- String.is_prefix dev "sd" ||
|
|
- String.is_prefix dev "hd" ||
|
|
- String.is_prefix dev "ubd" ||
|
|
- String.is_prefix dev "vd" ||
|
|
- String.is_prefix dev "sr"
|
|
+ String.starts_with "sd" dev ||
|
|
+ String.starts_with "hd" dev ||
|
|
+ String.starts_with "ubd" dev ||
|
|
+ String.starts_with "vd" dev ||
|
|
+ String.starts_with "sr" dev
|
|
) devs in
|
|
|
|
(* Ignore the root device. *)
|
|
@@ -81,7 +81,7 @@ let map_md_devices f =
|
|
let devs = Array.to_list devs in
|
|
let devs = List.filter (
|
|
fun dev ->
|
|
- String.is_prefix dev "md" &&
|
|
+ String.starts_with "md" dev &&
|
|
String.length dev >= 3 && Char.isdigit dev.[2]
|
|
) devs in
|
|
List.map f devs
|
|
@@ -111,7 +111,7 @@ and add_partitions dev =
|
|
(* Look in /sys/block/<device>/ for entries starting with
|
|
* <device>, eg. /sys/block/sda/sda1.
|
|
*)
|
|
- let parts = List.filter (fun part -> String.is_prefix part dev) parts in
|
|
+ let parts = List.filter (fun part -> String.starts_with dev part) parts in
|
|
let parts = List.map ((^) "/dev/") parts in
|
|
sort_device_names parts
|
|
|
|
@@ -133,7 +133,7 @@ let is_whole_device device =
|
|
(* A 'whole' block device will have a symlink to the device in its
|
|
* /sys/block directory
|
|
*)
|
|
- assert (String.is_prefix device "/dev/");
|
|
+ assert (String.starts_with "/dev/" device);
|
|
let device = String.sub device 5 (String.length device - 5) in
|
|
let devpath = sprintf "/sys/block/%s/device" device in
|
|
|
|
diff --git a/daemon/findfs.ml b/daemon/findfs.ml
|
|
index d5752869c..087aad27f 100644
|
|
--- a/daemon/findfs.ml
|
|
+++ b/daemon/findfs.ml
|
|
@@ -46,8 +46,8 @@ and findfs tag str =
|
|
(* Trim trailing \n if present. *)
|
|
let out = String.trim out in
|
|
|
|
- if String.is_prefix out "/dev/mapper/" ||
|
|
- String.is_prefix out "/dev/dm-" then (
|
|
+ if String.starts_with "/dev/mapper/" out ||
|
|
+ String.starts_with "/dev/dm-" out then (
|
|
match Lvm_utils.lv_canonical out with
|
|
| None ->
|
|
(* Ignore the case where 'out' doesn't appear to be an LV.
|
|
diff --git a/daemon/inspect_fs_unix.ml b/daemon/inspect_fs_unix.ml
|
|
index e27863e86..952a7cd15 100644
|
|
--- a/daemon/inspect_fs_unix.ml
|
|
+++ b/daemon/inspect_fs_unix.ml
|
|
@@ -163,7 +163,7 @@ and distro_of_os_release_id = function
|
|
| "opencloudos" -> Some DISTRO_OPENCLOUDOS
|
|
| "tencentos" -> Some DISTRO_TENCENTOS
|
|
| "opensuse" -> Some DISTRO_OPENSUSE
|
|
- | s when String.is_prefix s "opensuse-" -> Some DISTRO_OPENSUSE
|
|
+ | s when String.starts_with "opensuse-" s -> Some DISTRO_OPENSUSE
|
|
| "pardus" -> Some DISTRO_PARDUS
|
|
| "pld" -> Some DISTRO_PLD_LINUX
|
|
| "rhel" -> Some DISTRO_RHEL
|
|
@@ -593,7 +593,7 @@ and check_hostname_from_file filename =
|
|
|
|
let hostname = Chroot.f chroot read_small_file filename in
|
|
|
|
- let keep_line line = line <> "" && not (String.is_prefix line "#") in
|
|
+ let keep_line line = line <> "" && not (String.starts_with "#" line) in
|
|
let lines = Option.map (List.filter keep_line) hostname in
|
|
match lines with
|
|
| None | Some [] -> None
|
|
@@ -699,11 +699,11 @@ and check_hostname_freebsd () =
|
|
let rec loop = function
|
|
| [] ->
|
|
raise Not_found
|
|
- | line :: _ when String.is_prefix line "hostname=\"" ||
|
|
- String.is_prefix line "hostname='" ->
|
|
+ | line :: _ when String.starts_with "hostname=\"" line ||
|
|
+ String.starts_with "hostname='" line ->
|
|
let len = String.length line - 10 - 1 in
|
|
String.sub line 10 len
|
|
- | line :: _ when String.is_prefix line "hostname=" ->
|
|
+ | line :: _ when String.starts_with "hostname=" line ->
|
|
let len = String.length line - 9 in
|
|
String.sub line 9 len
|
|
| _ :: lines ->
|
|
diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml
|
|
index 395a1c794..1ec7cb1c1 100644
|
|
--- a/daemon/inspect_fs_unix_fstab.ml
|
|
+++ b/daemon/inspect_fs_unix_fstab.ml
|
|
@@ -82,13 +82,13 @@ and check_fstab_entry md_map root_mountable os_type aug entry =
|
|
* /dev/iso9660/FREEBSD_INSTALL can be found in FreeBSD's
|
|
* installation discs.
|
|
*)
|
|
- if (String.is_prefix spec "/dev/fd" &&
|
|
+ if (String.starts_with "/dev/fd" spec &&
|
|
String.length spec >= 8 && Char.isdigit spec.[7]) ||
|
|
- (String.is_prefix spec "/dev/cd" &&
|
|
+ (String.starts_with "/dev/cd" spec &&
|
|
String.length spec >= 8 && Char.isdigit spec.[7]) ||
|
|
spec = "/dev/floppy" ||
|
|
spec = "/dev/cdrom" ||
|
|
- String.is_prefix spec "/dev/iso9660/" then
|
|
+ String.starts_with "/dev/iso9660/" spec then
|
|
return None;
|
|
|
|
let mp = aug_get_noerrors aug (entry ^ "/file") in
|
|
@@ -103,20 +103,20 @@ and check_fstab_entry md_map root_mountable os_type aug entry =
|
|
if verbose () then eprintf "check_fstab_entry: mp=%s\n%!" mp;
|
|
|
|
(* Ignore certain mountpoints. *)
|
|
- if String.is_prefix mp "/dev/" ||
|
|
+ if String.starts_with "/dev/" mp ||
|
|
mp = "/dev" ||
|
|
- String.is_prefix mp "/media/" ||
|
|
- String.is_prefix mp "/proc/" ||
|
|
+ String.starts_with "/media/" mp ||
|
|
+ String.starts_with "/proc/" mp ||
|
|
mp = "/proc" ||
|
|
- String.is_prefix mp "/selinux/" ||
|
|
+ String.starts_with "/selinux/" mp ||
|
|
mp = "/selinux" ||
|
|
- String.is_prefix mp "/sys/" ||
|
|
+ String.starts_with "/sys/" mp ||
|
|
mp = "/sys" then
|
|
return None;
|
|
|
|
let mountable =
|
|
(* Resolve UUID= and LABEL= to the actual device. *)
|
|
- if String.is_prefix spec "UUID=" then (
|
|
+ if String.starts_with "UUID=" spec then (
|
|
let uuid = String.sub spec 5 (String.length spec - 5) in
|
|
let uuid = shell_unquote uuid in
|
|
(* Just ignore the device if the UUID cannot be resolved. *)
|
|
@@ -125,7 +125,7 @@ and check_fstab_entry md_map root_mountable os_type aug entry =
|
|
with
|
|
Failure _ -> return None
|
|
)
|
|
- else if String.is_prefix spec "LABEL=" then (
|
|
+ else if String.starts_with "LABEL=" spec then (
|
|
let label = String.sub spec 6 (String.length spec - 6) in
|
|
let label = shell_unquote label in
|
|
(* Just ignore the device if the label cannot be resolved. *)
|
|
@@ -135,7 +135,7 @@ and check_fstab_entry md_map root_mountable os_type aug entry =
|
|
Failure _ -> return None
|
|
)
|
|
(* EFI partition UUIDs and labels. *)
|
|
- else if String.is_prefix spec "PARTUUID=" then (
|
|
+ else if String.starts_with "PARTUUID=" spec then (
|
|
let uuid = String.sub spec 9 (String.length spec - 9) in
|
|
let uuid = shell_unquote uuid in
|
|
(* Just ignore the device if the UUID cannot be resolved. *)
|
|
@@ -144,7 +144,7 @@ and check_fstab_entry md_map root_mountable os_type aug entry =
|
|
with
|
|
Failure _ -> return None
|
|
)
|
|
- else if String.is_prefix spec "PARTLABEL=" then (
|
|
+ else if String.starts_with "PARTLABEL=" spec then (
|
|
let label = String.sub spec 10 (String.length spec - 10) in
|
|
let label = shell_unquote label in
|
|
(* Just ignore the device if the label cannot be resolved. *)
|
|
@@ -161,7 +161,7 @@ and check_fstab_entry md_map root_mountable os_type aug entry =
|
|
else if spec = "/dev/root" || (is_bsd && mp = "/") then
|
|
root_mountable
|
|
(* Resolve guest block device names. *)
|
|
- else if String.is_prefix spec "/dev/" then
|
|
+ else if String.starts_with "/dev/" spec then
|
|
resolve_fstab_device spec md_map os_type
|
|
(* In OpenBSD's fstab you can specify partitions
|
|
* on a disk by appending a period and a partition
|
|
@@ -347,7 +347,7 @@ and resolve_fstab_device spec md_map os_type =
|
|
eprintf "resolve_fstab_device: %s matched %s\n%!" spec what
|
|
in
|
|
|
|
- if String.is_prefix spec "/dev/mapper" then (
|
|
+ if String.starts_with "/dev/mapper" spec then (
|
|
debug_matching "/dev/mapper";
|
|
(* LVM2 does some strange munging on /dev/mapper paths for VGs and
|
|
* LVs which contain '-' character:
|
|
@@ -398,7 +398,7 @@ and resolve_fstab_device spec md_map os_type =
|
|
)
|
|
|
|
(* Ubuntu 22+ uses /dev/disk/by-uuid/ followed by a UUID. *)
|
|
- else if String.is_prefix spec "/dev/disk/by-uuid/" then (
|
|
+ else if String.starts_with "/dev/disk/by-uuid/" spec then (
|
|
debug_matching "diskbyuuid";
|
|
let uuid = String.sub spec 18 (String.length spec - 18) in
|
|
try
|
|
diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml
|
|
index 8bcda5eb8..dbaf4c362 100644
|
|
--- a/daemon/inspect_fs_windows.ml
|
|
+++ b/daemon/inspect_fs_windows.ml
|
|
@@ -94,11 +94,11 @@ and get_windows_systemroot_from_boot_ini boot_ini_path =
|
|
*)
|
|
let rec loop = function
|
|
| [] -> None
|
|
- | str :: rest when String.is_prefix str "[operating systems]" ->
|
|
+ | str :: rest when String.starts_with "[operating systems]" str ->
|
|
let rec loop2 = function
|
|
| [] -> []
|
|
- | str :: rest when String.is_prefix str "multi(" ||
|
|
- String.is_prefix str "scsi(" ->
|
|
+ | str :: rest when String.starts_with "multi(" str ||
|
|
+ String.starts_with "scsi(" str ->
|
|
str :: loop2 rest
|
|
| _ -> []
|
|
in
|
|
@@ -340,7 +340,7 @@ and get_drive_mappings h root data =
|
|
let device =
|
|
if typ = Hivex.REG_BINARY then (
|
|
if String.length blob >= 24 &&
|
|
- String.is_prefix blob "DMIO:ID:" (* GPT *) then
|
|
+ String.starts_with "DMIO:ID:" blob (* GPT *) then
|
|
map_registry_disk_blob_gpt (Lazy.force partitions) blob
|
|
else if String.length blob = 12 then
|
|
map_registry_disk_blob_mbr (Lazy.force devices) blob
|
|
diff --git a/daemon/ldm.ml b/daemon/ldm.ml
|
|
index 0aa9bc9de..2710f71c2 100644
|
|
--- a/daemon/ldm.ml
|
|
+++ b/daemon/ldm.ml
|
|
@@ -38,7 +38,7 @@ and list prefix =
|
|
let dir = Sys.readdir "/dev/mapper" in
|
|
let dir = Array.to_list dir in
|
|
let dir =
|
|
- List.filter (fun d -> String.is_prefix d prefix) dir in
|
|
+ List.filter (fun d -> String.starts_with prefix d) dir in
|
|
let dir = List.map ((^) "/dev/mapper/") dir in
|
|
List.sort compare dir
|
|
)
|
|
diff --git a/daemon/listfs.ml b/daemon/listfs.ml
|
|
index dfc5ad5a5..0139e927d 100644
|
|
--- a/daemon/listfs.ml
|
|
+++ b/daemon/listfs.ml
|
|
@@ -73,18 +73,18 @@ let rec list_filesystems () =
|
|
*)
|
|
and is_not_partitioned_device device =
|
|
let device =
|
|
- if String.is_prefix device "/dev/mapper/" then
|
|
+ if String.starts_with "/dev/mapper/" device then
|
|
Unix_utils.Realpath.realpath device
|
|
else
|
|
device in
|
|
- assert (String.is_prefix device "/dev/");
|
|
+ assert (String.starts_with "/dev/" device);
|
|
let dev_name = String.sub device 5 (String.length device - 5) in
|
|
let dev_dir = "/sys/block/" ^ dev_name in
|
|
|
|
(* Open the device's directory under /sys/block/<dev_name> and
|
|
* look for entries starting with <dev_name>, eg. /sys/block/sda/sda1
|
|
*)
|
|
- let is_device_partition file = String.is_prefix file dev_name in
|
|
+ let is_device_partition file = String.starts_with dev_name file in
|
|
let files = Array.to_list (Sys.readdir dev_dir) in
|
|
let has_partition = List.exists is_device_partition files in
|
|
|
|
@@ -157,7 +157,7 @@ and check_with_vfs_type ret device =
|
|
* for things which are members of some RAID or LVM set, most
|
|
* importantly "LVM2_member" which is a PV.
|
|
*)
|
|
- else if String.is_suffix vfs_type "_member" then
|
|
+ else if String.ends_with "_member" vfs_type then
|
|
()
|
|
|
|
(* Ignore encrypted partitions. These are also containers, as above. *)
|
|
diff --git a/daemon/md.ml b/daemon/md.ml
|
|
index b4ba3b442..f2679a02d 100644
|
|
--- a/daemon/md.ml
|
|
+++ b/daemon/md.ml
|
|
@@ -68,7 +68,7 @@ let md_detail md =
|
|
* remainder to lower case.
|
|
*)
|
|
let key =
|
|
- if String.is_prefix key "MD_" then
|
|
+ if String.starts_with "MD_" key then
|
|
String.sub key 3 (String.length key - 3)
|
|
else
|
|
key in
|
|
diff --git a/daemon/mount_utils.ml b/daemon/mount_utils.ml
|
|
index 57d3eb6cf..dab34d037 100644
|
|
--- a/daemon/mount_utils.ml
|
|
+++ b/daemon/mount_utils.ml
|
|
@@ -61,8 +61,8 @@ let rec umount_all () =
|
|
let mp = proc_unmangle_path mp in
|
|
|
|
(* Allow a mount directory like "/sysroot" or "/sysroot/..." *)
|
|
- if (sysroot_len > 0 && String.is_prefix mp sysroot) ||
|
|
- (String.is_prefix mp sysroot &&
|
|
+ if (sysroot_len > 0 && String.starts_with sysroot mp) ||
|
|
+ (String.starts_with sysroot mp &&
|
|
String.length mp > sysroot_len &&
|
|
mp.[sysroot_len] = '/') then
|
|
List.push_front mp mps
|
|
diff --git a/daemon/sfdisk.ml b/daemon/sfdisk.ml
|
|
index 3265d1e83..bdba9dc17 100644
|
|
--- a/daemon/sfdisk.ml
|
|
+++ b/daemon/sfdisk.ml
|
|
@@ -142,22 +142,22 @@ let part_get_gpt_attributes device partnum =
|
|
let out = String.sub out 1 (len-1) in
|
|
loop out acc
|
|
)
|
|
- else if String.is_prefix out "RequiredPartition" then (
|
|
+ else if String.starts_with "RequiredPartition" out then (
|
|
let acc = 0 :: acc in
|
|
let out = String.sub out 17 (len-17) in
|
|
loop out acc
|
|
)
|
|
- else if String.is_prefix out "NoBlockIOProtocol" then (
|
|
+ else if String.starts_with "NoBlockIOProtocol" out then (
|
|
let acc = 1 :: acc in
|
|
let out = String.sub out 17 (len-17) in
|
|
loop out acc
|
|
)
|
|
- else if String.is_prefix out "LegacyBIOSBootable" then (
|
|
+ else if String.starts_with "LegacyBIOSBootable" out then (
|
|
let acc = 2 :: acc in
|
|
let out = String.sub out 18 (len-18) in
|
|
loop out acc
|
|
)
|
|
- else if String.is_prefix out "GUID:" then (
|
|
+ else if String.starts_with "GUID:" out then (
|
|
let out = String.sub out 5 (len-5) in
|
|
loop out acc
|
|
)
|
|
diff --git a/daemon/utils.ml b/daemon/utils.ml
|
|
index 71d1cf25c..40584c9f1 100644
|
|
--- a/daemon/utils.ml
|
|
+++ b/daemon/utils.ml
|
|
@@ -85,11 +85,11 @@ let commandr ?(fold_stdout_on_stderr = false) prog args =
|
|
if verbose () then (
|
|
if stdout <> "" then (
|
|
eprintf "command: %s: stdout:\n%s%!" prog stdout;
|
|
- if not (String.is_suffix stdout "\n") then eprintf "\n%!"
|
|
+ if not (String.ends_with "\n" stdout) then eprintf "\n%!"
|
|
);
|
|
if stderr <> "" then (
|
|
eprintf "command: %s: stderr:\n%s%!" prog stderr;
|
|
- if not (String.is_suffix stderr "\n") then eprintf "\n%!"
|
|
+ if not (String.ends_with "\n" stderr) then eprintf "\n%!"
|
|
)
|
|
);
|
|
|
|
@@ -114,7 +114,7 @@ let command ?fold_stdout_on_stderr prog args =
|
|
let split_device_partition dev =
|
|
(* Skip /dev/ prefix if present. *)
|
|
let dev =
|
|
- if String.is_prefix dev "/dev/" then
|
|
+ if String.starts_with "/dev/" dev then
|
|
String.sub dev 5 (String.length dev - 5)
|
|
else dev in
|
|
|
|
diff --git a/generator/daemon.ml b/generator/daemon.ml
|
|
index da5593ce1..6221531d2 100644
|
|
--- a/generator/daemon.ml
|
|
+++ b/generator/daemon.ml
|
|
@@ -511,7 +511,7 @@ let rec generate_daemon_caml_interface modname () =
|
|
generate_header OCamlStyle GPLv2plus;
|
|
|
|
let is_ocaml_module_function = function
|
|
- | { impl = OCaml m } when String.is_prefix m (modname ^ ".") -> true
|
|
+ | { impl = OCaml m } when String.starts_with (modname ^ ".") m -> true
|
|
| { impl = OCaml _ } -> false
|
|
| { impl = C } -> false
|
|
in
|
|
--
|
|
2.47.1
|
|
|