search for: printexc

Displaying 20 results from an estimated 79 matches for "printexc".

2023 Jun 27
1
[PATCH libguestfs 1/4] ocaml: Replace old enter/leave_blocking_section calls
...e_system ();\n"; (* Free strings if we copied them above. *) List.iter ( diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c index 3888c94564..8c8aa46096 100644 --- a/ocaml/guestfs-c.c +++ b/ocaml/guestfs-c.c @@ -34,6 +34,7 @@ #include <caml/mlvalues.h> #include <caml/printexc.h> #include <caml/signals.h> +#include <caml/threads.h> #include <caml/unixsupport.h> #include "guestfs-c.h" @@ -395,12 +396,12 @@ event_callback_wrapper (guestfs_h *g, /* Ensure we are holding the GC lock before any GC operations are * possible. (RHBZ#725...
2018 Apr 27
0
[PATCH v5 2/3] daemon: list-filesystems: Don't list partitions which cannot hold file system.
...gpt_type = Parted.part_get_gpt_type device partnum in + is_ignored_gpt_type gpt_type + ) + else false in + + not (is_mbr_extended || is_gpt_ignored) + with exn -> + if verbose () then + eprintf "check_partition: %s: %s\n" + partition (Printexc.to_string exn); + true + (* Use vfs-type to check for a filesystem of some sort of [device]. * Returns [Some [device, vfs_type; ...]] if found (there may be * multiple devices found in the case of btrfs), else [None] if nothing @@ -140,20 +189,3 @@ and check_with_vfs_type device =...
2018 Jan 25
0
[PATCH v2 2/3] daemon: list-filesystems: Don't list partitions which cannot hold file system.
...+ + let mbr_type = Parted.part_get_mbr_part_type device partnum in + let is_extended = mbr_type = "extended" in + + not (is_ldm || is_msr || is_extended) + with exn -> + if verbose () then + eprintf "check_partition: %s: %s\n" + partition (Printexc.to_string exn); + true + (* Use vfs-type to check for a filesystem of some sort of [device]. * Returns [Some [device, vfs_type; ...]] if found (there may be * multiple devices found in the case of btrfs), else [None] if nothing @@ -140,20 +164,3 @@ and check_with_vfs_type device =...
2023 Jun 29
1
[v2v PATCH v2 2/3] lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard
...h user - 1)) - else - (Unix.getpwnam user).pw_uid in - debug "setting owner of %s to %d:root" file uid; - Unix.chown file uid 0 - with - | exn -> (* Print exception, but continue. *) - debug "could not set owner of %s: %s" - file (Printexc.to_string exn) - ) + if running_as_root && backend_is_libvirt () then + let user = Option.value ~default:"qemu" (libvirt_qemu_user ()) in + let uid = + if String.is_prefix user "+" then + int_of_string (String.sub user 1 (String.length user - 1)) +...
2016 Jun 13
1
[PATCH v2] sysprep: Add --network to enable the network (RHBZ#1345813).
...diff --git a/customize/customize_run.ml b/customize/customize_run.ml index d4950a2..b96e40c 100644 --- a/customize/customize_run.ml +++ b/customize/customize_run.ml @@ -50,7 +50,7 @@ let run (g : Guestfs.guestfs) root (ops : ops) = warning (f_"log file %s: %s (ignored)") logfile (Printexc.to_string exn) in (* Useful wrapper for scripts. *) - let do_run ~display cmd = + let do_run ~display ?(warn_failed_no_network = false) cmd = if not guest_arch_compatible then error (f_"host cpu (%s) and guest arch (%s) are not compatible, so you cannot use command line opti...
2023 Jun 29
1
[v2v PATCH v2 2/3] lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard
...(Unix.getpwnam user).pw_uid in > - debug "setting owner of %s to %d:root" file uid; > - Unix.chown file uid 0 > - with > - | exn -> (* Print exception, but continue. *) > - debug "could not set owner of %s: %s" > - file (Printexc.to_string exn) > - ) > + if running_as_root && backend_is_libvirt () then > + let user = Option.value ~default:"qemu" (libvirt_qemu_user ()) in > + let uid = > + if String.is_prefix user "+" then > + int_of_string (String.sub user 1...
2009 Nov 19
1
[PATCH] (Alternate?) locking patch
...-- a/src/generator.ml +++ b/src/generator.ml @@ -10176,18 +10176,39 @@ let output_to filename = in close +let perror msg = function + | Unix.Unix_error (err, _, _) -> + eprintf "%s: %s\n" msg (Unix.error_message err) + | exn -> + eprintf "%s: %s\n" msg (Printexc.to_string exn) + (* Main program. *) let () = check_functions (); - if not (Sys.file_exists "HACKING") then ( - eprintf "\ + let lock_fd = + try Unix.openfile "HACKING" [Unix.O_RDWR] 0 + with + | Unix.Unix_error (Unix.ENOENT, _, _) -> + eprintf &quot...
2018 Jan 28
9
guestfs_list_filesystems: skip block devices which cannot hold file system
Initial discussion is here: https://www.redhat.com/archives/libguestfs/2018-January/msg00188.html. v2 was posted here: https://www.redhat.com/archives/libguestfs/2018-January/msg00246.html. v3 comparing to v2 is just a rebase with slightly changed commits comments.
2023 Jun 29
1
[v2v PATCH v2 2/3] lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard
...ser).pw_uid in >> - debug "setting owner of %s to %d:root" file uid; >> - Unix.chown file uid 0 >> - with >> - | exn -> (* Print exception, but continue. *) >> - debug "could not set owner of %s: %s" >> - file (Printexc.to_string exn) >> - ) >> + if running_as_root && backend_is_libvirt () then >> + let user = Option.value ~default:"qemu" (libvirt_qemu_user ()) in >> + let uid = >> + if String.is_prefix user "+" then >> + int_of_st...
2018 Jan 25
2
[PATCH v2 1/3] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.
Instead of parsing 'parted' output OCaml implementation relies on the following facts: 1. The function is applicable for MBR partitions only (as noted in documentation and as function name suggests). 2. An attempt to call the function for non-MBR partition fails with "part_get_mbr_part_type can only be used on MBR Partitions" error and NULL is returned. 3. MBR partition table
2023 Jun 29
1
[v2v PATCH v2 2/3] lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard
...debug "setting owner of %s to %d:root" file uid; > >> - Unix.chown file uid 0 > >> - with > >> - | exn -> (* Print exception, but continue. *) > >> - debug "could not set owner of %s: %s" > >> - file (Printexc.to_string exn) > >> - ) > >> + if running_as_root && backend_is_libvirt () then > >> + let user = Option.value ~default:"qemu" (libvirt_qemu_user ()) in > >> + let uid = > >> + if String.is_prefix user "+" then &g...
2023 Jun 29
1
[v2v PATCH v2 2/3] lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard
...ot;setting owner of %s to %d:root" file uid; >>>> - Unix.chown file uid 0 >>>> - with >>>> - | exn -> (* Print exception, but continue. *) >>>> - debug "could not set owner of %s: %s" >>>> - file (Printexc.to_string exn) >>>> - ) >>>> + if running_as_root && backend_is_libvirt () then >>>> + let user = Option.value ~default:"qemu" (libvirt_qemu_user ()) in >>>> + let uid = >>>> + if String.is_prefix user "...
2015 May 26
2
[PATCH] api: Don't truncate /dev/stdout or /dev/stderr when used as FileOut.
...ually truncates the - * redirection file, which is pretty annoying to say the - * least. - *) - g#download logfile "/dev/stderr" + try g#download logfile "/dev/stderr" with exn -> warning (f_"log file %s: %s (ignored)") logfile (Printexc.to_string exn) in diff --git a/src/proto.c b/src/proto.c index a019625..a46a382 100644 --- a/src/proto.c +++ b/src/proto.c @@ -756,9 +756,18 @@ guestfs_int_recv_file (guestfs_h *g, const char *filename) g->user_cancel = 0; - fd = open (filename, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY|O_CLOE...
2018 Apr 27
4
[PATCH v5 0/3] libguestfs: guestfs_list_filesystems: skip block devices which cannot hold file system
This patch series: 1. Addresses comments from last review: part_get_mbr_part_type doesn't break original implementation in C. 2. Rebased on top of master and little bit refactored for readability. Mykola Ivanets (1): tests: md: Test guestfish list-filesystems command skips partitioned md devices. Nikolay Ivanets (2): daemon: Reimplement 'part_get_mbr_part_type' API in
2023 Jun 27
4
[PATCH libguestfs 0/4] Fix ups for OCaml 5
No action required here as I have pushed this already, this is just for your information. Rich.
2016 Feb 18
0
[PATCH 3/3] Add and use an helper error function
...*) - eprintf "supermin: internal error: Not_found exception was thrown\n"; - exit 1 + error "internal error: Not_found exception was thrown" | exn -> (* something not matched above *) - eprintf "supermin: exception: %s\n" (Printexc.to_string exn); - exit 1 + error "exception: %s" (Printexc.to_string exn) diff --git a/src/utils.ml b/src/utils.ml index 87c9cf7..4223be4 100644 --- a/src/utils.ml +++ b/src/utils.ml @@ -28,6 +28,13 @@ let (//) = Filename.concat let quote = Filename.quote let quoted_list names = S...
2016 Feb 18
4
[PATCH 0/3] supermin: miscellaneous cleanups
Hi, few cleanups in the supermin codebase; no actual functional change. Thanks, -- Pino Toscano (3): ext2: simplify tracking of visited modules utils: remove unused run_python function Add and use an helper error function src/build.ml | 20 +++++----------- src/dpkg.ml | 4 +--- src/ext2_initrd.ml | 10 ++++---- src/kernel.ml | 27
2017 Jul 14
0
[PATCH 19/27] daemon: Reimplement ‘list_filesystems’ API in the daemon, in OCaml.
...] if nothing + * is found. + *) +and check_with_vfs_type device = + let mountable = Mountable.of_device device in + let vfs_type = + try Blkid.vfs_type mountable + with exn -> + if verbose () then + eprintf "check_with_vfs_type: %s: %s\n" + device (Printexc.to_string exn); + "" in + + if vfs_type = "" then + Some [mountable, "unknown"] + + (* Ignore all "*_member" strings. In libblkid these are returned + * for things which are members of some RAID or LVM set, most + * importantly "LVM2_memb...
2015 Jul 08
0
[PATCH 6/6] customize: add basic subscription-manager operations
...ig with + | None -> None + | Some c -> + try + Some (Ini_reader.read_ini ~check_duplicated_sections:true + ~check_duplicated_fields:true c) + with exn -> + error (f_"cannot parse the subscription-manager configuration: %s") + (Printexc.to_string exn) + in + let sm_config_get_value group key = + let conf = + match sm_config with + | None -> + error (f_"subscription-manager configuration required for this operation") + | Some c -> c in + try Ini_reader.ini_get_value conf group key +...
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
...(f, x, body) ] ]; prog: [ [ defns = LIST0 defn; "do"; run = expr -> defns, run ] ]; END open Printf let program, run = try Gram.parse prog Loc.ghost (Stream.of_channel (open_in "fib.ml")) with | Loc.Exc_located(loc, e) -> printf "%s at line %d\n" (Printexc.to_string e) (Loc.start_line loc); exit 1 open Llvm let ( |> ) x f = f x type state = { fn: llvalue; blk: llbasicblock; vars: (string * llvalue) list } let bb state = builder_at_end state.blk let new_block state name = append_block name state.fn let find state v = try...