[PATCH] osinfo: revamp db reading (RHBZ#1359652)
by Pino Toscano
More recent versions of libosinfo switched the internal directory with
the XML files of OSes to a different layout (still with the same XML
format), causing libguestfs to not read them anymore. Furthermore, the
internal directory is going to disappear soon, replaced by a public
osinfo database [1].
Revamp the way libguestfs reads the data: first try the upcoming osinfo
layout, falling back to the current libosinfo layout (which is the same
as osinfo), and then to the old flat layout.
[1] https://gitlab.com/libosinfo/libosinfo/blob/master/docs/database-layout.txt
---
src/osinfo.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 140 insertions(+), 28 deletions(-)
diff --git a/src/osinfo.c b/src/osinfo.c
index f4e2c71..0caacfa 100644
--- a/src/osinfo.c
+++ b/src/osinfo.c
@@ -55,6 +55,7 @@
#include <assert.h>
#include <sys/types.h>
#include <libintl.h>
+#include <sys/stat.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
@@ -148,36 +149,109 @@ guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo,
* Note that failure to find or parse the XML files is *not* a fatal
* error, since we should fall back silently if these are not
* available. Although we'll emit some debug if this happens.
+ *
+ * Try to use the shared osinfo database layout (and location) first:
+ * https://gitlab.com/libosinfo/libosinfo/blob/master/docs/database-layout.txt
*/
-#define LIBOSINFO_DB_OS_PATH LIBOSINFO_DB_PATH "/oses"
-
static int read_osinfo_db_xml (guestfs_h *g, const char *filename);
+static int read_osinfo_db_flat (guestfs_h *g, const char *directory);
+static int read_osinfo_db_three_levels (guestfs_h *g, const char *directory);
+static int read_osinfo_db_directory (guestfs_h *g, const char *directory);
+
static int
read_osinfo_db (guestfs_h *g)
{
- DIR *dir = NULL;
- struct dirent *d;
int r;
size_t i;
+ const char *path;
assert (osinfo_db_size == 0);
- dir = opendir (LIBOSINFO_DB_OS_PATH);
+ /* (1) Try the shared osinfo directory, using either the
+ * $OSINFO_SYSTEM_DIR envvar or its default value.
+ */
+ path = getenv ("OSINFO_SYSTEM_DIR");
+ if (path == NULL)
+ path = "/usr/share/osinfo";
+ r = read_osinfo_db_three_levels (g, path);
+ if (r == -1)
+ goto error;
+ else if (r == 1)
+ return 0;
+
+ /* (2) Try the libosinfo directory, using the newer three-directory
+ * layout ($LIBOSINFO_DB_PATH / "os" / $group-ID / [file.xml]).
+ */
+ r = read_osinfo_db_three_levels (g, LIBOSINFO_DB_PATH "/os");
+ if (r == -1)
+ goto error;
+ else if (r == 1)
+ return 0;
+
+ /* (3) Try the libosinfo directory, using the old flat directory
+ * layout ($LIBOSINFO_DB_PATH / "oses" / [file.xml]).
+ */
+ r = read_osinfo_db_flat (g, LIBOSINFO_DB_PATH "/oses");
+ if (r == -1)
+ goto error;
+ else if (r == 1)
+ return 0;
+
+ /* Nothing found. */
+ return 0;
+
+ error:
+ /* Fatal error: free any database entries which have been read, and
+ * mark the database as having a permanent error.
+ */
+ if (osinfo_db_size > 0) {
+ for (i = 0; i < (size_t) osinfo_db_size; ++i)
+ free_osinfo_db_entry (&osinfo_db[i]);
+ }
+ free (osinfo_db);
+ osinfo_db = NULL;
+ osinfo_db_size = -1;
+
+ return -1;
+}
+
+static int
+read_osinfo_db_flat (guestfs_h *g, const char *directory)
+{
+ debug (g, "osinfo: loading flat database from %s", directory);
+
+ return read_osinfo_db_directory (g, directory);
+}
+
+static int
+read_osinfo_db_three_levels (guestfs_h *g, const char *directory)
+{
+ DIR *dir;
+ int r;
+
+ dir = opendir (directory);
if (!dir) {
- debug (g, "osinfo: %s: %s", LIBOSINFO_DB_OS_PATH, strerror (errno));
+ debug (g, "osinfo: %s: %s", directory, strerror (errno));
return 0; /* This is not an error: RHBZ#948324. */
}
- debug (g, "osinfo: loading database from %s", LIBOSINFO_DB_OS_PATH);
+ debug (g, "osinfo: loading 3-level-directories database from %s", directory);
for (;;) {
+ struct dirent *d;
+ CLEANUP_FREE char *pathname = NULL;
+ struct stat sb;
+
errno = 0;
d = readdir (dir);
if (!d) break;
- if (STRSUFFIX (d->d_name, ".xml")) {
- r = read_osinfo_db_xml (g, d->d_name);
+ pathname = safe_asprintf (g, "%s/%s", directory, d->d_name);
+
+ /* Iterate only on directories. */
+ if (stat (pathname, &sb) == 0 && S_ISDIR (sb.st_mode)) {
+ r = read_osinfo_db_directory (g, pathname);
if (r == -1)
goto error;
}
@@ -185,7 +259,7 @@ read_osinfo_db (guestfs_h *g)
/* Check for failure in readdir. */
if (errno != 0) {
- perrorf (g, "readdir: %s", LIBOSINFO_DB_OS_PATH);
+ perrorf (g, "readdir: %s", directory);
goto error;
}
@@ -193,26 +267,67 @@ read_osinfo_db (guestfs_h *g)
r = closedir (dir);
dir = NULL;
if (r == -1) {
- perrorf (g, "closedir: %s", LIBOSINFO_DB_OS_PATH);
+ perrorf (g, "closedir: %s", directory);
goto error;
}
- return 0;
+ return 1;
error:
if (dir)
closedir (dir);
- /* Fatal error: free any database entries which have been read, and
- * mark the database as having a permanent error.
- */
- if (osinfo_db_size > 0) {
- for (i = 0; i < (size_t) osinfo_db_size; ++i)
- free_osinfo_db_entry (&osinfo_db[i]);
+ return -1;
+}
+
+static int
+read_osinfo_db_directory (guestfs_h *g, const char *directory)
+{
+ DIR *dir;
+ int r;
+
+ dir = opendir (directory);
+ if (!dir) {
+ debug (g, "osinfo: %s: %s", directory, strerror (errno));
+ return 0; /* This is not an error: RHBZ#948324. */
}
- free (osinfo_db);
- osinfo_db = NULL;
- osinfo_db_size = -1;
+
+ for (;;) {
+ struct dirent *d;
+
+ errno = 0;
+ d = readdir (dir);
+ if (!d) break;
+
+ if (STRSUFFIX (d->d_name, ".xml")) {
+ CLEANUP_FREE char *pathname = NULL;
+
+ pathname = safe_asprintf (g, "%s/%s", directory, d->d_name);
+ r = read_osinfo_db_xml (g, pathname);
+ if (r == -1)
+ goto error;
+ }
+ }
+
+ /* Check for failure in readdir. */
+ if (errno != 0) {
+ perrorf (g, "readdir: %s", directory);
+ goto error;
+ }
+
+ /* Close the directory handle. */
+ r = closedir (dir);
+ dir = NULL;
+ if (r == -1) {
+ perrorf (g, "closedir: %s", directory);
+ goto error;
+ }
+
+ return 1;
+
+ error:
+ if (dir)
+ closedir (dir);
return -1;
}
@@ -221,13 +336,12 @@ static int read_iso_node (guestfs_h *g, xmlNodePtr iso_node, struct osinfo *osin
static int read_media_node (guestfs_h *g, xmlXPathContextPtr xpathCtx, xmlNodePtr media_node, struct osinfo *osinfo);
static int read_os_node (guestfs_h *g, xmlXPathContextPtr xpathCtx, xmlNodePtr os_node, struct osinfo *osinfo);
-/* Read a single XML file from LIBOSINFO_DB_OS_PATH/filename. Only
- * memory allocation failures are fatal errors here.
+/* Read a single XML file from pathname (which is a full path).
+ * Only memory allocation failures are fatal errors here.
*/
static int
-read_osinfo_db_xml (guestfs_h *g, const char *filename)
+read_osinfo_db_xml (guestfs_h *g, const char *pathname)
{
- CLEANUP_FREE char *pathname = NULL;
CLEANUP_XMLFREEDOC xmlDocPtr doc = NULL;
CLEANUP_XMLXPATHFREECONTEXT xmlXPathContextPtr xpathCtx = NULL;
CLEANUP_XMLXPATHFREEOBJECT xmlXPathObjectPtr xpathObj = NULL;
@@ -236,8 +350,6 @@ read_osinfo_db_xml (guestfs_h *g, const char *filename)
struct osinfo *osinfo;
size_t i;
- pathname = safe_asprintf (g, "%s/%s", LIBOSINFO_DB_OS_PATH, filename);
-
doc = xmlReadFile (pathname, NULL, XML_PARSE_NONET);
if (doc == NULL) {
debug (g, "osinfo: unable to parse XML file %s", pathname);
@@ -298,7 +410,7 @@ read_osinfo_db_xml (guestfs_h *g, const char *filename)
#if 0
debug (g, "osinfo: %s: %s%s%s%s=> arch %s live %s product %s type %d distro %d version %d.%d",
- filename,
+ pathname,
osinfo->re_system_id ? "<system-id/> " : "",
osinfo->re_volume_id ? "<volume-id/> " : "",
osinfo->re_publisher_id ? "<publisher-id/> " : "",
--
2.7.4
8 years, 4 months
[PATCH] osinfo: map "sled" as "sles"
by Pino Toscano
The "sles" distribution string in libguestfs represents both SLES and
SLED, so map the osinfo descriptions of "sled" distributions as "sles".
---
src/osinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/osinfo.c b/src/osinfo.c
index 907580e..7fdaf1c 100644
--- a/src/osinfo.c
+++ b/src/osinfo.c
@@ -625,7 +625,7 @@ parse_distro (guestfs_h *g, xmlNodePtr node, struct osinfo *osinfo)
osinfo->distro = OS_DISTRO_OPENSUSE;
else if (STREQ (content, "rhel"))
osinfo->distro = OS_DISTRO_RHEL;
- else if (STREQ (content, "sles"))
+ else if (STREQ (content, "sled") || STREQ (content, "sles"))
osinfo->distro = OS_DISTRO_SLES;
else if (STREQ (content, "ubuntu"))
osinfo->distro = OS_DISTRO_UBUNTU;
--
2.7.4
8 years, 4 months
[PATCH] osinfo: parse also single-digit version numbers
by Pino Toscano
Switch to guestfs_int_version_from_x_y_or_x to parse version numbers --
although, restrict the parsing to what could look like a valid version
number, to discard quickly version strings like "unknown".
This makes sure that Debian, Fedora, Mageia, and SLED ISOs have the
right version number.
---
src/osinfo.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/osinfo.c b/src/osinfo.c
index 0caacfa..907580e 100644
--- a/src/osinfo.c
+++ b/src/osinfo.c
@@ -62,6 +62,7 @@
#include "ignore-value.h"
#include "glthread/lock.h"
+#include "c-ctype.h"
#include "guestfs.h"
#include "guestfs-internal.h"
@@ -548,9 +549,12 @@ parse_version (guestfs_h *g, xmlNodePtr node, struct osinfo *osinfo)
CLEANUP_FREE char *content = NULL;
content = (char *) xmlNodeGetContent (node);
- if (content) {
+ /* We parse either "X.Y" or "X" as version strings, so try to parse
+ * only if the first character is a digit.
+ */
+ if (content && c_isdigit (content[0])) {
struct version version;
- int res = guestfs_int_version_from_x_y (g, &version, content);
+ int res = guestfs_int_version_from_x_y_or_x (g, &version, content);
if (res < 0)
return -1;
else if (res > 0) {
--
2.7.4
8 years, 4 months
[PATCH RFC supermin] ext2_initrd: error out if we can't add anything
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
If we failed to add something to initrd, just error out.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/ext2_initrd.ml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml
index d4a4e2f..d9a3a99 100644
--- a/src/ext2_initrd.ml
+++ b/src/ext2_initrd.ml
@@ -151,8 +151,12 @@ let rec build_initrd debug tmpdir modpath initrd =
visit topset;
close_out chan;
+ let num_visted = StringSet.cardinal !visited in
if debug >= 1 then
- printf "supermin: ext2: wrote %d modules to minimal initrd\n%!" (StringSet.cardinal !visited);
+ printf "supermin: ext2: wrote %d modules to minimal initrd\n%!" num_visted;
+
+ if num_visited == 0 then
+ error "failed to write any modules into minimal initrd, try 'depmod -a'"
(* This is the binary blob containing the init "script". *)
let init = binary_init () in
--
1.8.3.1
8 years, 4 months
How to debug supermin5 issue?
by Chen Hanxiao
Hi, Rich:
I met a supermin issue on CentOS 7.1:
supermin: version: 5.1.10
supermin: rpm: detected RPM version 4.11
supermin: package handler: fedora/rpm
supermin: acquiring lock on /root/test/aaa/lock
supermin: build: /usr/lib64/guestfs/supermin.d
supermin: build: visiting /usr/lib64/guestfs/supermin.d/base.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/lib64/guestfs/supermin.d/daemon.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/lib64/guestfs/supermin.d/excludefiles type uncompressed excludefiles
supermin: build: visiting /usr/lib64/guestfs/supermin.d/hostfiles type uncompressed hostfiles
supermin: build: visiting /usr/lib64/guestfs/supermin.d/init.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/lib64/guestfs/supermin.d/packages type uncompressed packages
supermin: build: visiting /usr/lib64/guestfs/supermin.d/udev-rules.tar.gz type gzip base image (tar)
supermin: build: 185 packages, including dependencies
supermin: build: 30676 files
supermin: build: 17495 files, after removing unreadable files
supermin: build: 8834 files, after matching excludefiles
supermin: build: 8840 files, after adding hostfiles
supermin: build: 8870 files, after munging
supermin: kernel: picked kernel vmlinuz-3.10.0-229.el7.x86_64
supermin: kernel: picked modules path /lib/modules/3.10.0-229.el7.x86_64
supermin: kernel: kernel_version 3.10.0-229.el7.x86_64
supermin: kernel: modules /lib/modules/3.10.0-229.el7.x86_64
supermin: ext2: creating empty ext2 filesystem '/root/test/aaa.8v6mujxm/root'
supermin: ext2: populating from base image
supermin: ext2: copying files from host filesystem
supermin: ext2: copying kernel modules
supermin: ext2: creating minimal initrd '/root/test/aaa.8v6mujxm/initrd'
supermin: ext2: wrote 0 modules to minimal initrd
^
|
It seam that supermin failed to write modules into initrd.
But it works fine on another centos 7.1 machine.
Could you please give me some hints on how to debug this kind of issue?
Thanks in advance.
Regards,
- Chen
8 years, 4 months
[PATCH] static const char *str -> static const char str[]
by Pino Toscano
Make all the static constant strings as char arrays, so they can be
fully stored in read-only memory.
---
align/scan.c | 2 +-
builder/index-validate.c | 2 +-
cat/cat.c | 2 +-
cat/filesystems.c | 2 +-
cat/log.c | 2 +-
cat/ls.c | 2 +-
daemon/guestfsd.c | 2 +-
df/main.c | 2 +-
diff/diff.c | 2 +-
edit/edit.c | 2 +-
fish/config.c | 4 ++--
fish/fish.c | 2 +-
format/format.c | 2 +-
fuse/guestmount.c | 2 +-
fuse/guestunmount.c | 2 +-
generator/daemon.ml | 2 +-
generator/fish.ml | 2 +-
inspector/inspector.c | 2 +-
make-fs/make-fs.c | 2 +-
p2v/main.c | 2 +-
rescue/rescue.c | 2 +-
src/appliance.c | 4 ++--
test-tool/test-tool.c | 2 +-
utils/boot-analysis/boot-analysis.c | 2 +-
utils/boot-benchmark/boot-benchmark.c | 2 +-
utils/qemu-boot/qemu-boot.c | 2 +-
utils/qemu-speed-test/qemu-speed-test.c | 2 +-
27 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/align/scan.c b/align/scan.c
index e7327ea..9575eda 100644
--- a/align/scan.c
+++ b/align/scan.c
@@ -107,7 +107,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:P:qvVx";
+ static const char options[] = "a:c:d:P:qvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
diff --git a/builder/index-validate.c b/builder/index-validate.c
index 6a87d7a..967c2d3 100644
--- a/builder/index-validate.c
+++ b/builder/index-validate.c
@@ -48,7 +48,7 @@ int
main (int argc, char *argv[])
{
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "V";
+ static const char options[] = "V";
static const struct option long_options[] = {
{ "help", 0, 0, HELP_OPTION },
{ "compat-1.24.0", 0, 0, 0 },
diff --git a/cat/cat.c b/cat/cat.c
index 4d671ca..9039f7f 100644
--- a/cat/cat.c
+++ b/cat/cat.c
@@ -88,7 +88,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:m:vVx";
+ static const char options[] = "a:c:d:m:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
diff --git a/cat/filesystems.c b/cat/filesystems.c
index cfdac86..ab24f2d 100644
--- a/cat/filesystems.c
+++ b/cat/filesystems.c
@@ -137,7 +137,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:hlvVx";
+ static const char options[] = "a:c:d:hlvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "all", 0, 0, 0 },
diff --git a/cat/log.c b/cat/log.c
index 6632f5a..bacd8b6 100644
--- a/cat/log.c
+++ b/cat/log.c
@@ -95,7 +95,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:vVx";
+ static const char options[] = "a:c:d:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
diff --git a/cat/ls.c b/cat/ls.c
index f990737..59cb914 100644
--- a/cat/ls.c
+++ b/cat/ls.c
@@ -132,7 +132,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:hlm:RvVx";
+ static const char options[] = "a:c:d:hlm:RvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "checksum", 2, 0, 0 },
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 15ec6ef..03d8f0a 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -141,7 +141,7 @@ usage (void)
int
main (int argc, char *argv[])
{
- static const char *options = "c:lnrtv?";
+ static const char options[] = "c:lnrtv?";
static const struct option long_options[] = {
{ "help", 0, 0, '?' },
{ "channel", 1, 0, 'c' },
diff --git a/df/main.c b/df/main.c
index 23cdaee..d266cec 100644
--- a/df/main.c
+++ b/df/main.c
@@ -103,7 +103,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:hiP:vVx";
+ static const char options[] = "a:c:d:hiP:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
diff --git a/diff/diff.c b/diff/diff.c
index 7469d65..72f197f 100644
--- a/diff/diff.c
+++ b/diff/diff.c
@@ -144,7 +144,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:A:c:d:D:hvVx";
+ static const char options[] = "a:A:c:d:D:hvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "all", 0, 0, 0 },
diff --git a/edit/edit.c b/edit/edit.c
index eb9dfbd..8a0c00c 100644
--- a/edit/edit.c
+++ b/edit/edit.c
@@ -103,7 +103,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:b:c:d:e:m:vVx";
+ static const char options[] = "a:b:c:d:e:m:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "backup", 1, 0, 'b' },
diff --git a/fish/config.c b/fish/config.c
index 0c3471a..8f10ad4 100644
--- a/fish/config.c
+++ b/fish/config.c
@@ -45,8 +45,8 @@
#ifdef HAVE_LIBCONFIG
#define GLOBAL_CONFIG_FILENAME "libguestfs-tools.conf"
-static const char *home_filename = /* $HOME/ */ ".libguestfs-tools.rc";
-static const char *etc_filename = "/etc/" GLOBAL_CONFIG_FILENAME;
+static const char home_filename[] = /* $HOME/ */ ".libguestfs-tools.rc";
+static const char etc_filename[] = "/etc/" GLOBAL_CONFIG_FILENAME;
static void
read_config_from_file (const char *filename)
diff --git a/fish/fish.c b/fish/fish.c
index d2cf359..2ce2039 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -183,7 +183,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:Df:h::im:nN:rvVwx";
+ static const char options[] = "a:c:d:Df:h::im:nN:rvVwx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "cmd-help", 2, 0, 'h' },
diff --git a/format/format.c b/format/format.c
index 2dbaa4d..5933aeb 100644
--- a/format/format.c
+++ b/format/format.c
@@ -104,7 +104,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:vVx";
+ static const char options[] = "a:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "filesystem", 1, 0, 0 },
diff --git a/fuse/guestmount.c b/fuse/guestmount.c
index a5a5d37..3308058 100644
--- a/fuse/guestmount.c
+++ b/fuse/guestmount.c
@@ -149,7 +149,7 @@ main (int argc, char *argv[])
/* The command line arguments are broadly compatible with (a subset
* of) guestfish. Thus we have to deal mainly with -a, -m and --ro.
*/
- static const char *options = "a:c:d:im:no:rvVwx";
+ static const char options[] = "a:c:d:im:no:rvVwx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
diff --git a/fuse/guestunmount.c b/fuse/guestunmount.c
index ba753ef..c686f40 100644
--- a/fuse/guestunmount.c
+++ b/fuse/guestunmount.c
@@ -76,7 +76,7 @@ main (int argc, char *argv[])
{
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "qvV";
+ static const char options[] = "qvV";
static const struct option long_options[] = {
{ "fd", 1, 0, 0 },
{ "help", 0, 0, HELP_OPTION },
diff --git a/generator/daemon.ml b/generator/daemon.ml
index cb8b6ba..31ca764 100644
--- a/generator/daemon.ml
+++ b/generator/daemon.ml
@@ -535,7 +535,7 @@ cleanup_free_mountable (mountable_t *mountable)
List.iter (
function
| typ, cols ->
- pr "static const char *lvm_%s_cols = \"%s\";\n"
+ pr "static const char lvm_%s_cols[] = \"%s\";\n"
typ (String.concat "," (List.map fst cols));
pr "\n";
diff --git a/generator/fish.ml b/generator/fish.ml
index 980f55f..cc869d3 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -107,7 +107,7 @@ let generate_fish_cmds () =
pr "#include \"cmds-gperf.h\"\n";
pr "\n";
pr "/* Valid suffixes allowed for numbers. See Gnulib xstrtol function. */\n";
- pr "static const char *xstrtol_suffixes = \"0kKMGTPEZY\";\n";
+ pr "static const char xstrtol_suffixes[] = \"0kKMGTPEZY\";\n";
pr "\n";
pr "/* Return these errors from run_* functions. */\n";
pr "#define RUN_ERROR -1\n";
diff --git a/inspector/inspector.c b/inspector/inspector.c
index d8e455e..4c027df 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:vVx";
+ static const char options[] = "a:c:d:vVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
diff --git a/make-fs/make-fs.c b/make-fs/make-fs.c
index 8ece991..2f91370 100644
--- a/make-fs/make-fs.c
+++ b/make-fs/make-fs.c
@@ -51,7 +51,7 @@ static const char *format = "raw", *label = NULL,
*partition = NULL, *size_str = NULL, *type = "ext2";
enum { HELP_OPTION = CHAR_MAX + 1 };
-static const char *options = "F:s:t:Vvx";
+static const char options[] = "F:s:t:Vvx";
static const struct option long_options[] = {
{ "debug", 0, 0, 'v' }, /* for compat with Perl tool */
{ "floppy", 0, 0, 0 },
diff --git a/p2v/main.c b/p2v/main.c
index 35f0b59..6a63df4 100644
--- a/p2v/main.c
+++ b/p2v/main.c
@@ -55,7 +55,7 @@ static void find_all_interfaces (void);
static int cpuinfo_flags (void);
enum { HELP_OPTION = CHAR_MAX + 1 };
-static const char *options = "Vv";
+static const char options[] = "Vv";
static const struct option long_options[] = {
{ "help", 0, 0, HELP_OPTION },
{ "cmdline", 1, 0, 0 },
diff --git a/rescue/rescue.c b/rescue/rescue.c
index 8012112..37b82f6 100644
--- a/rescue/rescue.c
+++ b/rescue/rescue.c
@@ -98,7 +98,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:m:rvVwx";
+ static const char options[] = "a:c:d:m:rvVwx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "append", 1, 0, 0 },
diff --git a/src/appliance.c b/src/appliance.c
index d293c2b..5748af5 100644
--- a/src/appliance.c
+++ b/src/appliance.c
@@ -38,8 +38,8 @@
#include "guestfs-internal.h"
/* Old-style appliance is going to be obsoleted. */
-static const char *kernel_name = "vmlinuz." host_cpu;
-static const char *initrd_name = "initramfs." host_cpu ".img";
+static const char kernel_name[] = "vmlinuz." host_cpu;
+static const char initrd_name[] = "initramfs." host_cpu ".img";
static int build_appliance (guestfs_h *g, char **kernel, char **initrd, char **appliance);
static int find_path (guestfs_h *g, int (*pred) (guestfs_h *g, const char *pelem, void *data), void *data, char **pelem);
diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c
index ad1601c..a5297ba 100644
--- a/test-tool/test-tool.c
+++ b/test-tool/test-tool.c
@@ -78,7 +78,7 @@ main (int argc, char *argv[])
bindtextdomain (PACKAGE, LOCALEBASEDIR);
textdomain (PACKAGE);
- static const char *options = "t:V?";
+ static const char options[] = "t:V?";
static const struct option long_options[] = {
{ "help", 0, 0, '?' },
{ "qemu", 1, 0, 0 },
diff --git a/utils/boot-analysis/boot-analysis.c b/utils/boot-analysis/boot-analysis.c
index 1b491c4..2b042d9 100644
--- a/utils/boot-analysis/boot-analysis.c
+++ b/utils/boot-analysis/boot-analysis.c
@@ -118,7 +118,7 @@ int
main (int argc, char *argv[])
{
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "m:v";
+ static const char options[] = "m:v";
static const struct option long_options[] = {
{ "help", 0, 0, HELP_OPTION },
{ "append", 1, 0, 0 },
diff --git a/utils/boot-benchmark/boot-benchmark.c b/utils/boot-benchmark/boot-benchmark.c
index 05cab50..fb946de 100644
--- a/utils/boot-benchmark/boot-benchmark.c
+++ b/utils/boot-benchmark/boot-benchmark.c
@@ -79,7 +79,7 @@ int
main (int argc, char *argv[])
{
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "m:";
+ static const char options[] = "m:";
static const struct option long_options[] = {
{ "help", 0, 0, HELP_OPTION },
{ "append", 1, 0, 0 },
diff --git a/utils/qemu-boot/qemu-boot.c b/utils/qemu-boot/qemu-boot.c
index 61d2ff0..2703014 100644
--- a/utils/qemu-boot/qemu-boot.c
+++ b/utils/qemu-boot/qemu-boot.c
@@ -93,7 +93,7 @@ int
main (int argc, char *argv[])
{
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "in:P:vx";
+ static const char options[] = "in:P:vx";
static const struct option long_options[] = {
{ "help", 0, 0, HELP_OPTION },
{ "ignore", 0, 0, 'i' },
diff --git a/utils/qemu-speed-test/qemu-speed-test.c b/utils/qemu-speed-test/qemu-speed-test.c
index 375a9a4..f26d71c 100644
--- a/utils/qemu-speed-test/qemu-speed-test.c
+++ b/utils/qemu-speed-test/qemu-speed-test.c
@@ -92,7 +92,7 @@ int
main (int argc, char *argv[])
{
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "t:";
+ static const char options[] = "t:";
static const struct option long_options[] = {
{ "help", 0, 0, HELP_OPTION },
{ "time", 1, 0, 't' },
--
2.7.4
8 years, 4 months
Do we need a rebase bug for RHEL 7.4?
by Richard W.M. Jones
Hi Pino,
$subject -- do we intend to rebase libguestfs, virt-v2v and virt-p2v
in RHEL 7.4? If yes, we should file the rebase bug soon.
Pros:
- The RHEL 7.3 package has 151 patches on top of 1.32.6. Rebasing
would get almost all those patches. Not rebasing would mean (at
predicted growth rate) shipping ~300-400 patches.
- Backporting patches is currently hard work since the code bases of
1.32 & 1.33/1.34 have diverged significantly in many areas.
- We have none of Roman's v2v patches in RHEL 7.3, and it would be
good to get all of those in 7.4 when we have the luxury of testing
everything properly.
Cons:
- Another large rebase.
- Maybe others, I need to look at the detailed changes in 1.32->1.34.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
8 years, 4 months
[PATCH] customize: password: use SHA-512 on Void Linux and Arch Linux
by Pino Toscano
They are rolling distributions, so we can assume they have a glibc
version greater than 2.7 (cca Oct 2007).
---
customize/password.ml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/customize/password.ml b/customize/password.ml
index 94b2f27..8a9fed3 100644
--- a/customize/password.ml
+++ b/customize/password.ml
@@ -165,6 +165,9 @@ and default_crypto g root =
| ("opensuse"|"sles"), v when v >= 11 -> `SHA512
| ("opensuse"|"sles"), _ -> `MD5
+ (* Rolling distributions, which hopefully should be updated enough. *)
+ | ("archlinux"|"voidlinux"), _ -> `SHA512
+
| _, _ ->
let minor = g#inspect_get_minor_version root in
warning (f_"password: using insecure md5 password encryption for guest of type %s version %d.%d.
--
2.7.4
8 years, 4 months
[PATCH] customize: use --noconfirm when installing Arch Linux packages
by Pino Toscano
Otherwise the installation will fail right away, since pacman by default
asks for confirmation of the operation.
---
customize/customize_run.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index 6f0d615..3e759a2 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
@@ -117,7 +117,7 @@ exec >>%s 2>&1
" quoted_args
| "dnf" -> sprintf "dnf -y install %s" quoted_args
| "pisi" -> sprintf "pisi it %s" quoted_args
- | "pacman" -> sprintf "pacman -S %s" quoted_args
+ | "pacman" -> sprintf "pacman -S --noconfirm %s" quoted_args
| "urpmi" -> sprintf "urpmi %s" quoted_args
| "xbps" -> sprintf "xbps-install -Sy %s" quoted_args
| "yum" -> sprintf "yum -y install %s" quoted_args
--
2.7.4
8 years, 4 months
[PATCH supermin] supermin: update out-dated comments
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
ext2initrd.c belongs to supermin4.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
init/init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init/init.c b/init/init.c
index 5ac53e9..fa9460d 100644
--- a/init/init.c
+++ b/init/init.c
@@ -138,7 +138,7 @@ main ()
/* XXX Because of the way we construct the module list, the
* "modules" file can contain non-existent modules. Ignore those
* for now. Really we should add them as missing dependencies.
- * See ext2initrd.c:ext2_make_initrd().
+ * See src/ext2_initrd.ml.
*/
if (access (line, R_OK) == 0)
insmod (line);
--
1.8.3.1
8 years, 4 months