Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions SPECS-EXTENDED/libguestfs/libguestfs-file-5.40.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
From 278d0d3226f4bdb7c6586986ca46d0a25c976fe4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <[email protected]>
Date: Wed, 31 Mar 2021 13:40:11 +0100
Subject: [PATCH] lib/appliance-kcmdline.c: Read UUID directly from appliance.

Instead of using the external file utility, read the UUID directly
from the extfs filesystem. file 5.40 broke parsing of UUIDs
(https://bugs.astron.com/view.php?id=253).

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1945122
---
lib/appliance-kcmdline.c | 75 +++++++++++++++++++++++++---------------
1 file changed, 48 insertions(+), 27 deletions(-)

diff --git a/lib/appliance-kcmdline.c b/lib/appliance-kcmdline.c
index 6d0deef867..8b78655eb2 100644
--- a/lib/appliance-kcmdline.c
+++ b/lib/appliance-kcmdline.c
@@ -27,6 +27,9 @@
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
+#include <fcntl.h>
+#include <libintl.h>
+#include <sys/types.h>

#include "c-ctype.h"
#include "ignore-value.h"
@@ -56,49 +59,67 @@
#define EARLYPRINTK "earlyprintk=pl011,0x9000000"
#endif

-COMPILE_REGEXP (re_uuid, "UUID=([-0-9a-f]+)", 0)
-
-static void
-read_uuid (guestfs_h *g, void *retv, const char *line, size_t len)
-{
- char **ret = retv;
-
- *ret = match1 (g, line, re_uuid);
-}
-
/**
* Given a disk image containing an extX filesystem, return the UUID.
- * The L<file(1)> command does the hard work.
*/
static char *
get_root_uuid_with_file (guestfs_h *g, const char *appliance)
{
- CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g);
- char *ret = NULL;
- int r;
+ unsigned char magic[2], uuid[16];
+ char *ret;
+ int fd;

- guestfs_int_cmd_add_arg (cmd, "file");
- guestfs_int_cmd_add_arg (cmd, "--");
- guestfs_int_cmd_add_arg (cmd, appliance);
- guestfs_int_cmd_set_stdout_callback (cmd, read_uuid, &ret, 0);
- r = guestfs_int_cmd_run (cmd);
- if (r == -1) {
- if (ret) free (ret);
+ fd = open (appliance, O_RDONLY|O_CLOEXEC);
+ if (fd == -1) {
+ perrorf (g, _("open: %s"), appliance);
return NULL;
}
- if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
- guestfs_int_external_command_failed (g, r, "file", NULL);
- if (ret) free (ret);
+ if (lseek (fd, 0x438, SEEK_SET) != 0x438) {
+ magic_error:
+ error (g, _("%s: cannot read extfs magic in superblock"), appliance);
+ close (fd);
+ return NULL;
+ }
+ if (read (fd, magic, 2) != 2)
+ goto magic_error;
+ if (magic[0] != 0x53 || magic[1] != 0xEF) {
+ error (g, _("%s: appliance is not an extfs filesystem"), appliance);
+ close (fd);
return NULL;
}
+ if (lseek (fd, 0x468, SEEK_SET) != 0x468) {
+ super_error:
+ error (g, _("%s: cannot read UUID in superblock"), appliance);
+ close (fd);
+ return NULL;
+ }
+ if (read (fd, uuid, 16) != 16)
+ goto super_error;
+ close (fd);

+ /* The UUID is a binary blob, but we must return it as a printable
+ * string. The caller frees this.
+ */
+ ret = safe_asprintf (g,
+ "%02x%02x%02x%02x" "-"
+ "%02x%02x" "-"
+ "%02x%02x" "-"
+ "%02x%02x" "-"
+ "%02x%02x%02x%02x%02x%02x",
+ uuid[0], uuid[1], uuid[2], uuid[3],
+ uuid[4], uuid[5],
+ uuid[6], uuid[7],
+ uuid[8], uuid[9],
+ uuid[10], uuid[11], uuid[12], uuid[13],
+ uuid[14], uuid[15]);
return ret;
}

/**
- * Read the first 256k bytes of the in_file with L<qemu-img(1)> command
- * and write them into the out_file. That may be useful to get UUID of
- * the QCOW2 disk image with further L<file(1)> command.
+ * Read the first 256k bytes of the in_file with L<qemu-img(1)>
+ * command and write them into the out_file. That may be useful to get
+ * UUID of the QCOW2 disk image with C<get_root_uuid_with_file>.
+ *
* The function returns zero if successful, otherwise -1.
*/
static int
59 changes: 59 additions & 0 deletions SPECS-EXTENDED/libguestfs/libguestfs-ocaml413compat.patch
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,62 @@ index 4237ea5..8847717 100644
| [] -> default
| (y, y') :: _ when cmp x y = 0 -> y'
| _ :: ys -> assoc_lbl ~cmp ~default x ys

From 5f499208cf53ebd3f05525918c213a36c3ca13b5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <[email protected]>
Date: Tue, 2 Mar 2021 10:42:49 +0000
Subject: [PATCH] builder: Don't redefine Val_none (OCaml 4.12).

CC virt_builder-setlocale-c.o
setlocale-c.c:38: error: "Val_none" redefined [-Werror]
38 | #define Val_none (Val_int (0))
|
In file included from /usr/lib64/ocaml/caml/alloc.h:24,
from setlocale-c.c:23:
/usr/lib64/ocaml/caml/mlvalues.h:395: note: this is the location of the previous definition
395 | #define Val_none Val_int(0)
|
---
builder/setlocale-c.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/builder/setlocale-c.c b/builder/setlocale-c.c
index 6d877e7ac..1834c11df 100644
--- a/builder/setlocale-c.c
+++ b/builder/setlocale-c.c
@@ -35,7 +35,9 @@ static const int lc_string_table[7] = {
LC_MESSAGES
};

+#ifndef Val_none
#define Val_none (Val_int (0))
+#endif

extern value virt_builder_setlocale (value val_category, value val_name);

--
2.29.0.rc2

From 80abb37b53fc1297de7644ed5a3506c4c1f9375e Mon Sep 17 00:00:00 2001
From: Stephane Glondu <[email protected]>
Date: Sun, 26 Dec 2021 10:03:35 +0100
Subject: [PATCH] Do not error on warning 6 [labels-omitted]

---
m4/guestfs-ocaml.m4 | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4
index bf07799..c40a173 100644
--- a/m4/guestfs-ocaml.m4
+++ b/m4/guestfs-ocaml.m4
@@ -231,7 +231,7 @@ EOF
])

dnl Flags we want to pass to every OCaml compiler call.
-OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX+52-3"
+OCAML_WARN_ERROR="-warn-error +C+D+E+F+L+M+P+S+U+V+Y+Z+X+52-3-6"
AC_SUBST([OCAML_WARN_ERROR])
OCAML_FLAGS="-g -annot $safe_string_option"
AC_SUBST([OCAML_FLAGS])
--
2.34.1
3 changes: 2 additions & 1 deletion SPECS-EXTENDED/libguestfs/libguestfs.signatures.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"copy-patches.sh": "9e0112d9b85f80f48697ffefbb6cc3a1eda527ea5ff065f48e08440dfba573e8",
"guestfish.sh": "5efae0e6b38c7a137265bc1f3988dc9734a99a08a87ffbcfa1715aefe3982d29",
"libguestfs-1.44.0.tar.gz": "0ec7b44a4c50e928583c56099da31ceb9680766043bd7d468f3ca7b741c55d21",
"tdnf-build-cache.repo": "646e3ff6dddf3b088edf141796b6b081fe6f82dba6f1f7f32b426581a065c7c6",
"yum.conf.in": "2ca1e0ea6814436211715f14975e211263db10f09fca1fdef51c5aa3fe52a357"
}
}
}
Loading