Commit Graph

12387 Commits

Author SHA1 Message Date
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
Richard W.M. Jones
548af2929e daemon/selinux.c: Fix compilation when no libselinux
/usr/bin/ld: /tmp/ccvSGq6E.ltrans7.ltrans.o:(.data.rel.ro+0x1f8): undefined reference to `optgroup_selinuxrelabel_available'

The reason is that we didn't include optgroup_selinuxrelabel_available
on the fallback / no libselinux code path.

Reported-by: David Runge
Thanks: Toolybird
Fixes: https://github.com/libguestfs/libguestfs/issues/290
Fixes: commit ed40333a23
2026-01-19 14:53:12 +00:00
Richard W.M. Jones
29162f5fe5 lib/appliance-cpu.c: Use -cpu max for RISC-V
Reported-by: https://github.com/Apache553
Fixes: https://github.com/libguestfs/libguestfs/issues/292
2026-01-19 14:53:00 +00:00
Anders Roxell
7fee08e53f tar_in: add keepdirlink option for --keep-directory-symlink
Add a new optional boolean argument 'keepdirlink' to tar_in that passes
--keep-directory-symlink to tar. This preserves existing symlinks to
directories when extracting, which is important for usrmerge systems
where /lib is a symlink to /usr/lib.

Without this option, extracting a tarball containing lib/modules/...
to / would replace the /lib symlink with a real directory, breaking
the system.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
2026-01-19 12:39:59 +00:00
Richard W.M. Jones
5da8102f5f lib/qemu.c: Don't start the guest when checking QMP properties
When checking for QMP properties, we run a qemu command and interact
with the QMP console.  However we also start the guest running (there
is no actual guest in this situation).  This occasionally causes this
line to be printed:

  libguestfs: generic_qmp_test: 3: {"timestamp": {"seconds": 1768823946, "microseconds": 898287}, "event": "GUEST_PANICKED", "data": {"action": "poweroff", "info": {"core": 0, "psw-addr": 0, "reason": "disabled-wait", "psw-mask": 562956395872256, "type": "s390"}}}\r\n

which confuses our parser.

As there is no reason to start the non-existent guest, add the -S
option which causes qemu to start up in a paused state.

For some reason this only happens on s390x but I think it could happen
on all architectures, so it may be a timing issue or something
particular about s390x firmware.
2026-01-19 12:03:59 +00:00
Richard W.M. Jones
bbbc982bf5 lib/qemu.c: Add debugging to generic_qmp_test()
This function fails sometimes on s390x, but it's hard to tell what is
going on because of insufficient debugging.
2026-01-19 10:27:24 +00:00
Richard W.M. Jones
0fe8c0492c lib/qemu.c: Turn debug messages which are really errors into error()
Commit 669eda1e24 ("lib/launch-direct.c: Simplify test for KVM, remove
qemu caching") made it so that failure of generic_qmp_test() will
cause launch to fail.  However we still used debug messages to print
the error, so unless you have debugging enabled you wouldn't see any
error message if this function fails.

Updates: commit 669eda1e24
2026-01-19 10:20:55 +00:00
Hosted Weblate
d16be4592b 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-06 12:57:49 +00:00