search for: guestfs_push_error_handler

Displaying 20 results from an estimated 111 matches for "guestfs_push_error_handler".

2015 Jun 06
0
[PATCH 3/5] threads: Use thread-local storage for errors.
We permit the following constructs in libguestfs code: if (guestfs_some_call (g) == -1) { fprintf (stderr, "failed: error is %s\n", guestfs_last_error (g)); } and: guestfs_push_error_handler (g, NULL, NULL); guestfs_some_call (g); guestfs_pop_error_handler (g); Neither of these would be safe if we allowed the handle to be used from threads concurrently, since the error string or error handler could be changed by another thread. Solve this in approximately the same way that libvir...
2017 Jul 21
0
[PATCH v3 REPOST 5/5] threads: Add a test.
...= 0; iterations < 1000; ++iterations) { + guestfs_set_hv (g, "test"); + p = guestfs_get_hv (g); + if (!p || STRNEQ (p, "test")) { + fprintf (stderr, "invalid return from guestfs_get_hv\n"); + pthread_exit ((void *)-1); + } + free (p); + + guestfs_push_error_handler (g, NULL, NULL); + guestfs_set_hv (g, "test"); + p = guestfs_get_hv (g); + guestfs_pop_error_handler (g); + if (!p || STRNEQ (p, "test")) { + fprintf (stderr, "invalid return from guestfs_get_hv\n"); + pthread_exit ((void *)-1); + } + free (...
2015 Jun 16
5
[PATCH threads v2 0/5] Add support for thread-safe handle.
Previous discussion here: https://www.redhat.com/archives/libguestfs/2015-June/thread.html#00048 v2: - Use a cleanup handler to release the lock. - Rebase to upstream. Note I have not fixed the problem(s) with error handling (patch 3).
2015 Jun 06
7
[PATCH 0/5] Add support for thread-safe handle.
This patch isn't ready to go upstream. In fact, I think we might do a quick 1.30 release soon, and save this patch, and also the extensive changes proposed for the test suite[1], to after 1.30. Currently it is not safe to use the same handle from multiple threads, unless you implement your own mutexes. See: http://libguestfs.org/guestfs.3.html#multiple-handles-and-multiple-threads These
2014 Dec 09
0
[PATCH] inspection: Not an installer if there are multiple partitions (RHBZ#1171666).
...ice); return 0; } @@ -1786,25 +1785,3 @@ make_augeas_path_expression (guestfs_h *g, const char **configfiles) debug (g, "augeas pathexpr = %s", ret); return ret; } - -static int -is_partition (guestfs_h *g, const char *partition) -{ - CLEANUP_FREE char *device = NULL; - - guestfs_push_error_handler (g, NULL, NULL); - - if ((device = guestfs_part_to_dev (g, partition)) == NULL) { - guestfs_pop_error_handler (g); - return 0; - } - - if (guestfs_device_index (g, device) == -1) { - guestfs_pop_error_handler (g); - return 0; - } - - guestfs_pop_error_handler (g); - - return 1; -}...
2017 Jun 27
9
[PATCH v3 0/5] threads: Add support for thread-safe handle.
Previously posted in 2015: v1: https://www.redhat.com/archives/libguestfs/2015-June/msg00048.html v2: https://www.redhat.com/archives/libguestfs/2015-June/msg00118.html I have rebased and tidied up the patches, fixing a few spelling mistakes, but they are broadly the same as before. I also ran all the tests, which pass. As with the previous versions, this makes a change to the API, where you
2017 Jun 27
0
[PATCH v3 3/5] threads: Use thread-local storage for errors.
We permit the following constructs in libguestfs code: if (guestfs_some_call (g) == -1) { fprintf (stderr, "failed: error is %s\n", guestfs_last_error (g)); } and: guestfs_push_error_handler (g, NULL, NULL); guestfs_some_call (g); guestfs_pop_error_handler (g); Neither of these would be safe if we allowed the handle to be used from threads concurrently, since the error string or error handler could be changed by another thread. Solve this in approximately the same way that libvir...
2020 Sep 07
5
[PATCH common v2 0/4] Windows BitLocker support.
For links to the original patch series, see: https://bugzilla.redhat.com/show_bug.cgi?id=1808977#c8 The original feedback was that ignoring errors from guestfs_luks_uuid would ignore legitimate errors from non-BitLocker disks, so I have modified this series so that errors are only ignored in the BitLocker case. As noted in the 4th patch there is no actual error in the BitLocker case, cryptsetup
2020 Mar 30
6
[PATCH common 0/4] options: Support Windows BitLocker (RHBZ#1808977).
Support transparent decryption/inspection of Windows guests encrypted with BitLocker encryption. This won't make much sense without the associated libguestfs patches which I will post momentarily. (Submodules, ho hum) Rich.
2016 Jun 08
1
[PATCH] filesystems: don't try to get the size of btrfs subvolume
...476,27 @@ do_output_filesystems (void) } } if ((columns & COLUMN_SIZE)) { - size = guestfs_blockdev_getsize64 (g, fses[i]); - if (size == -1) + CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]); + CLEANUP_FREE char *subvolume = NULL; + + guestfs_push_error_handler (g, NULL, NULL); + + subvolume = guestfs_mountable_subvolume (g, fses[i]); + if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) { + fprintf (stderr, + _("%s: cannot determine the subvolume for %s: %s (%d)\n"), + guestfs_int_p...
2016 Jun 15
1
[PATCH v2] filesystems: don't try to get the size of btrfs subvolume
...476,28 @@ do_output_filesystems (void) } } if ((columns & COLUMN_SIZE)) { - size = guestfs_blockdev_getsize64 (g, fses[i]); - if (size == -1) + CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]); + CLEANUP_FREE char *subvolume = NULL; + + guestfs_push_error_handler (g, NULL, NULL); + + subvolume = guestfs_mountable_subvolume (g, fses[i]); + if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) { + fprintf (stderr, + _("%s: cannot determine the subvolume for %s: %s: %s\n"), + guestfs_int_pr...
2020 Sep 17
1
Re: [PATCH v2 7/7] lib/canonical-name.c: Hide errors.
...; +++ b/lib/canonical-name.c > @@ -46,8 +46,9 @@ guestfs_impl_canonical_device_name (guestfs_h *g, const char *device) > } > else if (STRPREFIX (device, "/dev/mapper/") || > STRPREFIX (device, "/dev/dm-")) { > - /* XXX hide errors */ > + guestfs_push_error_handler (g, NULL, NULL); > ret = guestfs_lvm_canonical_lv_name (g, device); > + guestfs_pop_error_handler (g); Instead of ignoring all the errors from lvm_canonical_lv_name, isn't there a way to avoid getting into this situation in the first place? Right now it is not ignored, so if anyt...
2017 Jul 10
2
Re: [PATCH v3 3/5] threads: Use thread-local storage for errors.
On Tuesday, 27 June 2017 13:55:57 CEST Richard W.M. Jones wrote: > We permit the following constructs in libguestfs code: > > if (guestfs_some_call (g) == -1) { > fprintf (stderr, "failed: error is %s\n", guestfs_last_error (g)); > } > > and: > > guestfs_push_error_handler (g, NULL, NULL); > guestfs_some_call (g); > guestfs_pop_error_handler (g); > > Neither of these would be safe if we allowed the handle to be used > from threads concurrently, since the error string or error handler > could be changed by another thread. > > Solve this i...
2016 Jan 26
1
[PATCH] inspect: resolve symlinks when detecting architecture
...ck the architecture of their target. + */ + if (guestfs_is_file_opts (g, binaries[i], + GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) { + CLEANUP_FREE char *resolved = NULL; + + /* Ignore errors from realpath and file_architecture calls. */ guestfs_push_error_handler (g, NULL, NULL); - arch = guestfs_file_architecture (g, binaries[i]); + resolved = guestfs_realpath (g, binaries[i]); + /* If is_file above succeeded realpath should too, but better + * be safe than sorry. + */ + if (resolved) + arch = guestfs_file_architectur...
2020 Feb 26
1
[PATCH] filesystems: fix size reporting for filesystems
...do_output_filesystems (void) guestfs_pop_error_handler (g); if (!device || !subvolume) { - size = guestfs_blockdev_getsize64 (g, fses[i]); + /* Try mounting and stating the device. This might reasonably + * fail, so don't show errors. + */ + guestfs_push_error_handler (g, NULL, NULL); + + if (guestfs_mount_ro (g, fses[i], "/") == 0) { + CLEANUP_FREE_STATVFS struct guestfs_statvfs *stat = NULL; + + stat = guestfs_statvfs (g, "/"); + size = stat->blocks * stat->bsize; + guestfs_umount_all (g); +...
2020 Oct 06
2
Re: [PATCH common v2 4/4] options: Ignore errors from guestfs_luks_uuid.
...uuid = guestfs_luks_uuid (g, partitions[i]); >+ else { >+ /* This may fail for Windows BitLocker disks because >+ * cryptsetup luksUUID cannot read a UUID (unclear if >+ * this is a limitation of the format or cryptsetup). >+ */ >+ guestfs_push_error_handler (g, NULL, NULL); >+ uuid = guestfs_luks_uuid (g, partitions[i]); I have yet to look at the libguestfs patches, but I do not completely understand what is the reason for calling "guestfs_luks_uuid" when you know it will fail. Or is there a case when it might be useful to get the...
2015 Jun 11
2
Re: [PATCH 3/5] threads: Use thread-local storage for errors.
On Sat, Jun 06, 2015 at 02:20:39PM +0100, Richard W.M. Jones wrote: > We permit the following constructs in libguestfs code: > > if (guestfs_some_call (g) == -1) { > fprintf (stderr, "failed: error is %s\n", guestfs_last_error (g)); > } > > and: > > guestfs_push_error_handler (g, NULL, NULL); > guestfs_some_call (g); > guestfs_pop_error_handler (g); > > Neither of these would be safe if we allowed the handle to be used > from threads concurrently, since the error string or error handler > could be changed by another thread. > > Solve this i...
2016 Oct 11
1
Re: [PATCH v3 1/2] New tool: virt-tail.
On Monday, 3 October 2016 15:07:10 CEST Richard W.M. Jones wrote: > This follows (tails) a log file within a guest, rather like > the regular 'tail -f' command. For example: > > virt-tail -d guest /var/log/messages > --- Mostly LGTM, just a few notes. > + guestfs_push_error_handler (g, NULL, NULL); > + stat = guestfs_statns (g, filename); > + guestfs_pop_error_handler (g); > + if (stat == NULL) { > + /* There's an error. Treat ENOENT as if the file was empty size. */ > + if (guestfs_last_errno (g) == ENOENT) { > + t...
2018 Oct 04
0
[PATCH v2 3/4] inspector: Use libxml writer macros.
...erWriteElement (xo, BAD_CAST "package_management", - BAD_CAST str)); - free (str); - - /* inspect-get-windows-systemroot will fail with non-windows guests, - * or if the systemroot could not be determined for a windows guest. - * Disable error output around this call. - */ - guestfs_push_error_handler (g, NULL, NULL); - str = guestfs_inspect_get_windows_systemroot (g, root); - if (str) - XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "windows_systemroot", - BAD_CAST str)); - free (str); - str = guestfs_inspect_get_win...
2015 Oct 16
1
[PATCH] inspect: Include more information for augeas parse errors (RHBZ#1229119)
...ot;)) { - error (g, _("augeas could not parse %s"), configfiles[i]); + CLEANUP_FREE char *errorpath = + safe_asprintf (g, "/augeas/files%s/error", configfiles[i]); + + if (STREQ (*match, errorpath)) { + /* Get the various error details. */ + guestfs_push_error_handler (g, NULL, NULL); + CLEANUP_FREE char *messagepath = + safe_asprintf (g, "%s/message", errorpath); + CLEANUP_FREE char *message = guestfs_aug_get (g, messagepath); + CLEANUP_FREE char *linepath = + safe_asprintf (g, "%s/line", errorpath); +...