Commit Graph

12394 Commits

Author SHA1 Message Date
Richard W.M. Jones
48607d9d15 m4/guestfs-ocaml.m4: Check for caml_unix_error
In OCaml 5.0, unix_error was renamed caml_unix_error.

If it's not available, define as unix_error, the old symbol name.
2026-03-17 16:13:05 +00:00
Richard W.M. Jones
3bff5a6f79 Update common submodule
Pulls in the following commits:

  Cole Robinson (2):
      virtio-win: Install blnsvr.exe to C:\Windows\Drivers\VirtIO
      build: mark some ocaml commands with $(AM_V_GEN)

  Richard W.M. Jones (6):
      mlstdutils: Export List.assoc_opt
      mlcustomize/firstboot.ml: Be more careful about quoting
      mlcustomize: Create a sentinel file when firstboot completes
      mlutils/c_utils-c.c: Throw Unix_error on failure
      Use caml_unix_error instead of unix_error
      mlutils/unix_utils.ml: statvfs_is_network_filesystem should not be noalloc

  grass-lu (1):
      Add support for Kylin, NeoKylin and Anolis Linux

  shivanayak (5):
      common: fix FILE stream leak in worker_thread on guestfs_create failure (#27)
      options: fix memory leak in read_key on getline failure (#30)
      edit: check WIFEXITED before WEXITSTATUS in edit_file_editor and edit_file_perl (#31)
      mlutils: fix pattern leak in mkdtemp wrapper on failure
      qemuopts: check for write errors in qemuopts_to_channel and qemuopts_to_config_channel (#33)
2026-03-16 09:17:48 +00:00
Richard W.M. Jones
2d2eba643d lib/proto.c: Avoid generating events for incorrect progress messages
If xdr_guestfs_progress fails to decode the progress message, don't
generate an event callback.

Closes: https://github.com/libguestfs/libguestfs/pull/329
2026-03-16 09:13:56 +00:00
shivanayak
8d4d35c604 ocaml: fix memory leak in guestfs_int_ocaml_strings_val on strdup failure (#324)
When strdup() fails partway through the loop, caml_raise_out_of_memory()
longjmps without freeing the previously allocated strings or the array.
Free all prior allocations before raising the exception.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-15 09:55:02 +00:00
shivanayak
92c2e1e79e lib: fix drive struct leak on hotplug error in guestfs_impl_add_drive_opts (#318)
When guestfs_impl_add_drive_opts is called outside CONFIG state, the
hotplug error path returns -1 without freeing the already-allocated
drv structure.

Co-authored-by: Claude Local LLM <noreply@anthropic.com>
2026-03-11 09:56:16 +00:00
shivanayak
2bc54b40f7 lib: fix realpath memory leak on error paths in set_abs_path (#317)
When realpath() succeeds but subsequent operations fail, the
allocated path is leaked. Add free(ret) before returning -1
on both error paths.

Co-authored-by: Claude <norep@anthropic.com>
2026-03-11 09:37:00 +00:00
Richard W.M. Jones
47c2233026 daemon/blkid.c: Fix compilation error introduced by earlier change
blkid.c: In function ‘test_blkid_p_i_opt’:
  blkid.c:105:3: error: label ‘command_failed’ defined but not used [-Werror=unused-label]
    105 |   command_failed:
        |   ^~~~~~~~~~~~~~

Fixes: https://github.com/libguestfs/libguestfs/pull/315
Fixes: commit ff4467a1a4
2026-03-10 08:31:27 +00:00
shivanayak
065c997f5b fish: fix fd leak and undefined behavior on fdopen failure in rc_listen (#320)
Add missing NULL check after fdopen in both rc_listen and rc_remote.
In rc_listen, fdopen failure on a valid fd indicates something
fundamentally broken, so abort. In rc_remote, return an error to
the caller.

Co-authored-by: Claude <nor@anthropic.com>
2026-03-10 08:21:35 +00:00
shivanayak
2fc54b8121 lib: fix ownership leaks in FUSE cache insert functions on malloc failure (#321)
In rlc_insert and xac_insert (lib/fuse.c), both functions take
ownership of a parameter (link and xattrs respectively) but fail to
free it when their own malloc calls fail. Under memory pressure in a
long-running FUSE process, each failed cache insertion leaks the
owned resource.

Co-authored-by: Claude <nore@anthro.com>
2026-03-09 18:29:54 +00:00
shivanayak
91578639c6 daemon: fix fd leak in do_inotify_files on error paths (#319)
When popen or do_inotify_read fails, the file descriptor created by
mkstemp is never closed before returning. Add close(fd) to both
error paths to prevent file descriptor leaks.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-09 18:15:38 +00:00
shivanayak
ff4467a1a4 daemon: fix low severity bugs in debug, file, and blkid (#315)
- debug.c: fix memory leak of out buffer on opendir failure in
  debug_fds. After fclose on open_memstream, the out buffer is
  allocated and must be freed.

- file.c: add missing reply_with_perror on strdup failure in
  do_zfile, so callers get a proper error message instead of
  silent NULL return.

- blkid.c: fix wrong error variable used at command_failed label
  in test_blkid_p_i_opt. The second commandr stores its error in
  err2, but goto command_failed would report err from the first
  command. Inline the error reporting with the correct variable.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-09 18:14:32 +00:00
shivanayak
a47c923b05 lib: fix memory leak of query_kvm in guestfs_int_platform_has_kvm (#316)
The string allocated by generic_qmp_test via safe_strdup is passed to
parse_has_kvm but never freed afterwards, leaking memory on every KVM
capability check. Use CLEANUP_FREE to ensure automatic cleanup.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-09 17:22:27 +00:00
shivanayak
25c321a8fd daemon: fix temp file leak in do_vgmeta on error paths (#314)
When vgcfgbackup fails or subsequent file operations fail, the
temporary file created by mkstemp is never unlinked. Add unlink(tmp)
to all error paths after mkstemp to prevent temp files accumulating
in /tmp.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 16:48:56 +00:00
shivanayak
cb233a73c6 daemon: fix memory leak in do_aug_match on realloc failure (#313)
When realloc fails, vp is NULL so free(vp) is a no-op. The original
matches array (and all r strings allocated by aug_match) is leaked.
Use free_stringslen to properly free the array and its contents.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 16:46:00 +00:00
Cole Robinson
9b890de878 po-docs: hide deprecation warnings
The build emits a lot of warnings like this:

po4a-translate is deprecated. The unified po4a(1) program is more convenient and less error prone. Once
configured, `po4a --no-update` can be used as a drop-in replacement to `po4a-translate`.
po4a::pod: A new SimplePod parser is now available.  Please consider using it instead of the current Pod
           module. If you encounter any bugs, your reports would be greatly appreciated.  To use it, add
           the following line at the top of your po4a configuration file: "[po4a_alias:Pod] SimplePod".
           You can disable this message by setting the no-warn-simple option.  Sorry for the noise, and
           thank you!

But we can suppress them with some options to the po4a tools.

Actually fixing it is tracked here:
https://github.com/libguestfs/libguestfs/issues/312

(cherry picked from virt-v2v commit
 865f1ced9fedd9c3121b44b2f3461727ce9dfadc)

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2026-02-20 10:26:11 -05:00
Cole Robinson
08503c2482 build: fix make dist with java disabled
Fails for me with:

  No rule to make target 'com_redhat_et_libguestfs_GuestFS.h'

libguestfs_jni_la_SOURCES is inside the `HAVE_JAVA` conditional,
but apparently with automake that doesn't matter, and _SOURCES
will always be copied into Makefile.in, making `make dist` fail
even if we never built anything in the java/ directory.

That header is in BUILT_SOURCES already which apparently does
what we want (and is _not_ copied unconditionally to Makefile.in).
So just drop the offending line

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2026-02-19 09:09:02 -05:00
Cole Robinson
9451c1a2ef ci: make it easier to test in forked branches
+ start branch names with `ci/` to easily test in a fork
+ add `workflow_dispatch` to allow manually triggering jobs on
  any branch

Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit v2v
 df23b503c22579468d7c544c1724507ede84948d)
2026-02-18 12:07:04 -05:00
Hilko Bengen
5a4977fc66 lib/qemu.c: Dump qemu's stderr if QMP test fails
Qemu will refuse to start on some (all?) architectures if firmware
files are missing, or for other reasons, and complain to stderr. Those
messages should be made visible to the user as part of the error message.
2026-02-17 07:05:56 +00:00
Cole Robinson
50701c8325 ci: More fixes and tweaks
+ ubuntu
  + fix build by adding --disable-ruby
  + fix a test failure due to missing python libvirt import

+ fedora
  + use `--privileged` docker flag which also handles seccomp disable
    + this makes some network tests work, so enable them

  + exclude a flakey test
  + better document remaining disabled tests

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2026-02-16 08:53:27 +00:00
Cole Robinson
358d17dea1 ci: Drop su -c usage
The `su -c` usage seems to be leftover from someone else's
CI config that was used for inspiration. Drop it. Test suite
in containers now run as root.

The libvirt pieces and new test exclusions were what I needed
to get the test suite working under root

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2026-02-12 13:45:54 -05:00
Richard W.M. Jones
5eda6f1b60 Version 1.59.3. v1.59.3 2026-02-11 14:20:46 +00:00
Richard W.M. Jones
d428c6fee8 build: Remove Vala bindings
They depend on gobject introspection which was removed in previous
commits.

Updates: commit 955ea8882b
2026-02-11 14:06:14 +00:00
Richard W.M. Jones
7e2170e9e0 build: Remove m4/introspection.m4
Updates: commit 955ea8882b
2026-02-11 14:06:14 +00:00
Cole Robinson
19033cf2f1 tests: python: drop skipUnlessLibvirtHasCPointer
This was added in 2014, we can safely depend on it being available
now. Existing tests will ensure it doesn't regress

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2026-02-11 09:03:41 -05:00
Richard W.M. Jones
8ded6e8858 Revert "daemon: send_dirent_info: Use designated compound literal for tsk_dirent"
This breaks compilation:

tsk.c: In function ‘send_dirent_info’:
tsk.c:209:32: error: passing argument 2 of ‘file_metadata’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  209 |   file_metadata (fsfile->meta, &dirent);
      |                                ^~~~~~~
tsk.c:51:43: note: expected ‘guestfs_int_tsk_dirent *’ but argument is of type ‘const struct guestfs_int_tsk_dirent *’
   51 | static void file_metadata (TSK_FS_META *, guestfs_int_tsk_dirent *);
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~
tsk.c:211:43: error: passing argument 2 of ‘xdr_guestfs_int_tsk_dirent’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  211 |   ret = xdr_guestfs_int_tsk_dirent (&xdr, &dirent);
      |                                           ^~~~~~~
In file included from tsk.c:29:
../common/protocol/guestfs_protocol.h:5215:51: note: expected ‘guestfs_int_tsk_dirent *’ but argument is of type ‘const struct guestfs_int_tsk_dirent *’
 5215 | extern  bool_t xdr_guestfs_int_tsk_dirent (XDR *, guestfs_int_tsk_dirent*);
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~

This reverts commit b5000cf547.
2026-02-11 12:07:22 +00:00
Cole Robinson
955ea8882b Remove deprecated GObject bindings
These were marked as deprecated in a57f6b8e2. Time to remove them

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2026-02-10 14:29:55 -05:00
Richard W.M. Jones
eed58cc443 build: Add $(NULL) as a convenient list terminator
When building lists of things in Makefiles it's convenient to have a
list terminator to avoid hanging backslash problems.  eg:

  EXTRA_DIST = \
           thing1 \
           thing2 \
           $(NULL)

Cherry picked from virt-v2v commit 09b86c07bf19beba9ccb8fcca0ebfae34dd56406
Cherry picked from guestfs-tools commit dad8c0d3803dcbc91e22ca35c630d9e8a01df81b
2026-02-05 12:55:52 +00:00
Richard W.M. Jones
a5925f5e14 po: Keep LINGUAS files sorted
Updates: 37ab22454e
2026-02-02 10:14:42 +00:00
Hosted Weblate
049b5d8a58 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2026-02-02 10:13:52 +00:00
Arif Budiman
37ab22454e Added translation using Weblate (Indonesian)
Added translation using Weblate (Indonesian)
2026-02-02 10:13:52 +00:00
Richard W.M. Jones
923b319886 appliance: Add suggested udevadm monitor command
While debugging some udev issues, I found use of 'udevadm monitor' to
be fairly useful.  Add a suggested debugging command that might be
used, but comment it out.

Thanks: Alasdair Kergon
2026-01-27 16:36:12 +00:00
Richard W.M. Jones
8cd9adb239 appliance/packagelist.in: Add apfs-fuse
Add this package (Fedora only for now) to provide very minimal support
for APFS, the Apple Filesystem.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2432498
2026-01-27 16:03:51 +00:00
Richard W.M. Jones
9e0bb093e3 Version 1.59.2. v1.59.2 2026-01-26 15:00:54 +00:00
Richard W.M. Jones
45d0e66d02 tests/disks/debug-qemu.sh: Fix test for update QMP test
Commit f7a24b2ea8 ("lib/qemu.c: Use machine type none when inspecting
QMP properties") changed the number of command line parameters used
before the '-qmp stdio' option when libguestfs queries qemu features.
This broke some tests which rely on the exact order of parameters.

Fixes: commit f7a24b2ea8
Updates: commit 5da8102f5f
2026-01-26 14:59:13 +00:00
Richard W.M. Jones
7833461af7 generator: Deprecate xfs_info (replaced by xfs_info2)
Deprecate this function, and suggest using xfs_info2 as its
replacement.
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
e1deb358ce daemon: Reimplement xfs_info using xfs_info2
Remove all the complicated old C parsing code and reimplement xfs_info
using xfs_info2.  Note that this function will be deprecated.
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
dfd2700616 New API: xfs_info2
Reimplement xfs_info by returning a hash table of values (rather than
a limited struct), and by writing it in OCaml with PCRE which makes
string parsing a lot simpler.  This will now flexibly return all the
fields from the underlying xfs_info command, even (hopefully) future
fields.

Note the field values are returned as strings, because the actual
fields in xfs_info output are fairly random and free-form.  There is a
trade off here between returning as much information as we can, and
requiring the user to do a bit of (simple) field parsing.

Fixes: https://issues.redhat.com/browse/RHEL-143673
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
1c9c03bcd4 generator: Fix description of xfs_info
The returned struct contains filesystem metadata, not "geometry
information" (whatever that means).
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
6166304be6 generator: Fix description of xfs_growfs
This function does not return "geometry information".  Remove
the bogus description.
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
f7a24b2ea8 lib/qemu.c: Use machine type none when inspecting QMP properties
Dan mentioned that there is a special machine type ("none") we can use
when querying for KVM.  It has no CPU, memory, etc and does not run,
but you can still enable KVM for it.

Note we have to remove the -cpu parameter, otherwise qemu prints this
error:

  qemu-kvm: apic-id property was not initialized properly

Updates: commit 5da8102f5f
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
2026-01-26 14:32:30 +00:00
Hosted Weblate
8dc104c2f0 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2026-01-22 10:48:55 +00:00
Nathan
589066f2b1 Translated using Weblate (Italian)
Currently translated at 1.4% (205 of 14137 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/it/
2026-01-22 10:48:55 +00:00
Richard W.M. Jones
1b79e22be4 generator/daemon.ml: Avoid not available macro for OCaml functions
Reported-by: Toolybird
Fixes: https://github.com/libguestfs/libguestfs/issues/290
2026-01-19 22:19:27 +00:00
Richard W.M. Jones
8b3fc15190 website/index.html.in: Fix stable/development branch links 2026-01-19 19:43:56 +00:00
Richard W.M. Jones
9ffe190fbe Version 1.59.1. v1.59.1 2026-01-19 19:42:01 +00:00
Richard W.M. Jones
da70ed1360 po: Keep LINGUAS files sorted 2026-01-19 18:51:36 +00:00
Nathan
bb649ff0ba Added translation using Weblate (Italian) 2026-01-19 18:51:01 +00:00
Temuri Doghonadze
f887d3cb54 Translated using Weblate (Georgian)
Currently translated at 16.6% (160 of 962 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2026-01-19 18:51:01 +00:00
Hosted Weblate
0443ba7778 Update translation files
Updated by "Update LINGUAS file" hook in Weblate.

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/

Update translation files

Updated by "Update LINGUAS file" hook in Weblate.

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/

Update translation files

Updated by "Update LINGUAS file" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2026-01-19 18:51:01 +00:00
Languages add-on
b6bb5b96c2 Added translation using Weblate (Italian)
Added translation using Weblate (Telugu)

Added translation using Weblate (Tamil)

Added translation using Weblate (Russian)

Added translation using Weblate (Polish)

Added translation using Weblate (Punjabi)

Added translation using Weblate (Odia)

Added translation using Weblate (Marathi)

Added translation using Weblate (Malayalam)

Added translation using Weblate (Kannada)

Added translation using Weblate (Georgian)

Added translation using Weblate (Hindi)

Added translation using Weblate (Gujarati)

Added translation using Weblate (Portuguese (Brazil))
2026-01-19 18:51:01 +00:00