search for: failwith

Displaying 20 results from an estimated 158 matches for "failwith".

Did you mean: failwithf
2011 Oct 18
5
[PATCH febootstrap] Some cleanups for Debian and Ubuntu
I just tried to get libguestfs to compile on Ubuntu 11.10 using the latest febootstrap, and the following patches were necessary for me. They are all just reasonable code cleanups *except* for patch 5/5 which is a gross hack for something I don't understand about how Ubuntu 11.10 multiarch support works. Rich.
2008 Aug 22
1
sd(NA)
Hi All: This was discussed in the R-developers list (see the thread starting at http://tolstoy.newcastle.edu.au/R/e3/devel/ 07/12/0560.html). It has to do with the behavior of sd() when the entire vector is NA. The behavior has changed between 2.6 and 2.7.1 as follows: Run in Version 2.7.1 > tt<-rep(NA, 10) > mean(tt, na.rm=T) [1] NaN >sd(tt, na.rm=T) Error in var(x,
2014 Oct 03
0
[PATCH v3] tests: Introduce test harness for running tests.
..._absolute path = + let cmd = sprintf "unset CDPATH; cd %s && pwd" (Filename.quote path) in + let chan = open_process_in cmd in + let path = input_line chan in + (match close_process_in chan with + | WEXITED 0 -> () + | WEXITED _ + | WSIGNALED _ + | WSTOPPED _ -> + failwith (sprintf "failed to convert relative path to absolute path: %s" + cmd) + ); + path + +let mkdtemp () = + let chan = open_process_in "mktemp -d" in + let path = input_line chan in + (match close_process_in chan with + | WEXITED 0 -> () + | WEXITED _ + |...
2014 Oct 05
0
[PATCH v5 1/7] tests: Introduce test harness for running tests.
..._absolute path = + let cmd = sprintf "unset CDPATH; cd %s && pwd" (Filename.quote path) in + let chan = open_process_in cmd in + let path = input_line chan in + (match close_process_in chan with + | WEXITED 0 -> () + | WEXITED _ + | WSIGNALED _ + | WSTOPPED _ -> + failwith (sprintf "failed to convert relative path to absolute path: %s" + cmd) + ); + path + +let get_lines cmd = + let chan = open_process_in cmd in + let rec loop acc = + try + let line = input_line chan in + loop (line :: acc) + with End_of_file -> List.re...
2016 Aug 19
1
[PATCH] virt-rescue rewrite in OCaml
Hi, I tried to rewrite virt-rescue from C to OCaml. Goals were feature parity with C implementation, smaller codebase and hopefully better maintainability. I still don't know if I've covered everything right. So, please check it out. PS: my git send-email seems to be broken, so I'm sending it from thunderbird Thanks! maros
2015 Aug 06
0
[PATCH v4 01/17] tests: Introduce test harness for running tests.
...+ +let relative_path_to_absolute path = + let cmd = sprintf "realpath %s" (Filename.quote path) in + let chan = open_process_in cmd in + let path = input_line chan in + (match close_process_in chan with + | WEXITED 0 -> () + | WEXITED _ + | WSIGNALED _ + | WSTOPPED _ -> + failwith "realpath command failed, see earlier errors" + ); + path + +let get_lines cmd = + let chan = open_process_in cmd in + let rec loop acc = + try + let line = input_line chan in + loop (line :: acc) + with End_of_file -> List.rev acc + in + let lines = loop [] in +...
2017 May 26
2
[PATCH 0/2] mllib: Export some more functions to the generator.
These functions are already linked to the generator, they're just not exported. Rich.
2018 Jan 15
6
[PATCH v2 0/3] copying gpt attributes
Hi all, Here is the latest version of the series addressing Pino's comments. Cédric Bosdonnat (3): daemon: make sgdisk_info_extract_uuid_field more generic New APIs: part_set_gpt_attributes and part_get_gpt_attributes resize: copy GPT partition flags daemon/parted.ml | 45 +++++++++++++++++++++++++++++++++++---------- daemon/parted.mli | 3 +++
2016 Jul 07
0
[PATCH v3 4/8] mllib: Add some imperative list manipulation functions.
...ib/common_utils.ml @@ -282,6 +282,26 @@ let sort_uniq ?(cmp = Pervasives.compare) xs = let xs = uniq ~cmp xs in xs +let push xsp x = xsp := !xsp @ [x] +let unshift x xsp = xsp := x :: !xsp +let pop xsp = + let x, xs = + match List.rev !xsp with + | x :: xs -> x, xs + | [] -> failwith "pop" in + xsp := List.rev xs; + x +let shift xsp = + let x, xs = + match !xsp with + | x :: xs -> x, xs + | [] -> failwith "shift" in + xsp := xs; + x + +let append xsp xs = xsp := !xsp @ xs +let prepend xs xsp = xsp := xs @ !xsp + let may f = function |...
2018 Jan 16
0
[PATCH v3 2/3] New APIs: part_set_gpt_attributes and part_get_gpt_attributes
...nsertions(+), 1 deletion(-) diff --git a/daemon/parted.ml b/daemon/parted.ml index 6fe803613..ce8da8a60 100644 --- a/daemon/parted.ml +++ b/daemon/parted.ml @@ -17,6 +17,7 @@ *) open Scanf +open Printf open Std_utils @@ -124,10 +125,29 @@ let part_get_parttype device = | _ -> failwithf "%s: cannot parse the output of parted" device +let part_set_gpt_attributes device partnum attributes = + if partnum <= 0 then failwith "partition number must be >= 1"; + + udev_settle (); + + let arg = sprintf "%d:=:%LX" partnum attributes in + let r, _,...
2018 Jan 15
0
[PATCH v2 2/3] New APIs: part_set_gpt_attributes and part_get_gpt_attributes
...| 2 ++ lib/MAX_PROC_NR | 2 +- 5 files changed, 66 insertions(+), 1 deletion(-) diff --git a/daemon/parted.ml b/daemon/parted.ml index 6fe803613..e3ab823bd 100644 --- a/daemon/parted.ml +++ b/daemon/parted.ml @@ -124,10 +124,30 @@ let part_get_parttype device = | _ -> failwithf "%s: cannot parse the output of parted" device +let part_set_gpt_attributes device partnum attributes = + if partnum <= 0 then failwith "partition number must be >= 1"; + + udev_settle (); + + let hex = Printf.sprintf "%LX" attributes in + let arg = string...
2018 Jan 16
4
[PATCH v3 0/3] copy GPT attributes
Hi all, Here is v3 of the series, taking Richard's comments in account. Cédric Bosdonnat (3): daemon: make sgdisk_info_extract_uuid_field more generic New APIs: part_set_gpt_attributes and part_get_gpt_attributes resize: copy GPT partition flags daemon/parted.ml | 45 +++++++++++++++++++++++++++++++++++---------- daemon/parted.mli | 2 ++ generator/actions_core.ml
2017 Sep 20
4
[PATCH 0/4] Replace some uses of the Str module with PCRE.
Str is a pretty ugly regexp module. Let's try to replace it with PCRE. This series of commits goes some small way towards that eventual goal. - - - I wonder if there was a deep reason why we had this? let unix2dos s = String.concat "\r\n" (Str.split_delim (Str.regexp_string "\n") s) I replaced it with what I think should be (nearly) equivalent: let unix2dos s =
2018 Aug 22
1
Re: [PATCH 2/2] OCaml tools: add output selection for --machine-readable
...pen_machine_readable_channel () = > + match !machine_readable_output with > + | NoOutput -> > + (* Trying to use machine_readable_printf when --machine-readable was > + * not enabled, and thus machine_readable () returns false. > + *) > + failwith "internal error: machine_readable_printf used with no --machine-readable" I wonder if there's a way to avoid this error at compile time. Replace the ‘machine_readable ()’ function that returns boolean with one which returns an optional printf function. Then caller code would do:...
2019 Jan 23
2
[supermin PATCH 1/2] rpm: extend the Multiple_matches exception
Add the package that raised the issue, so it can be used to provide better diagnostic. --- src/librpm-c.c | 15 ++++++++++----- src/librpm.ml | 4 ++-- src/librpm.mli | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/librpm-c.c b/src/librpm-c.c index 3bd25a2..75ca4d7 100644 --- a/src/librpm-c.c +++ b/src/librpm-c.c @@ -66,10 +66,15 @@ librpm_handle_closed (void) }
2018 Jan 10
0
[PATCH 2/3] New APIs: part_set_gpt_attributes and part_get_gpt_attributes
...| 2 ++ lib/MAX_PROC_NR | 2 +- 5 files changed, 63 insertions(+), 2 deletions(-) diff --git a/daemon/parted.ml b/daemon/parted.ml index cf1a54a08..5f553c2da 100644 --- a/daemon/parted.ml +++ b/daemon/parted.ml @@ -124,7 +124,19 @@ let part_get_parttype device = | _ -> failwithf "%s: cannot parse the output of parted" device -let hex_chars = "0123456789ABCDEF" +let part_set_gpt_attributes device partnum attributes = + if partnum <= 0 then failwith "partition number must be >= 1"; + + udev_settle (); + + let arg = string_of_int part...
2017 Sep 22
0
[PATCH v3 02/22] common/mlpcre: Add PCRE.subi to return indexes instead of the substring.
..."ccac" = true); assert (sub 1 = "a"); assert (sub 2 = ""); - assert (sub 0 = "a") + assert (sub 0 = "a"); + assert (subi 0 = (2, 3)); + assert (subi 1 = (2, 3)); + assert (subi 2 = (3, 3)) with | Not_found -> failwith "one of the PCRE.sub functions unexpectedly raised Not_found" | PCRE.Error (msg, code) -> failwith (sprintf "PCRE error: %s (PCRE error code %d)" msg code) -(* Run some out of range [sub] calls to ensure an exception is thrown. *) +(* Run some out of range [sub] an...
2017 Jul 14
0
[PATCH 20/27] daemon: Reimplement ‘part_list’ API in OCaml.
...ring.trim out in + let lines = String.nsplit "\n" out in + + (* lines[0] is "BYT;", lines[1] is the device line which we ignore, + * lines[2..] are the partitions themselves. + *) + match lines with + | "BYT;" :: _ :: lines -> lines + | [] | [_] -> + failwith "too few rows of output from 'parted print' command" + | _ -> + failwith "did not see 'BYT;' magic value in 'parted print' command" + +let part_list device = + let lines = print_partition_table ~add_m_option:true device in + + List.map ( + fu...
2018 Jan 10
6
[PATCH 0/3] Handle GPT attribute flags
Hi all, Here is the series fixing the bug I mentioned on IRC regarding the GPT attribute flags to copy to the new disk in a virt-resize. Cédric Bosdonnat (3): daemon: make sgdisk_info_extract_uuid_field more generic New APIs: part_set_gpt_attributes and part_get_gpt_attributes resize: copy GPT partition flags daemon/parted.ml | 34 +++++++++++++++++++++++++++-------
2015 Mar 10
0
[PATCH] v2v: Add the test-harness used by external tests.
...+| Boot_to_screenshot of string + +let default_plan = { + post_conversion_test = None; + boot_plan = Boot_to_idle; + boot_wait_to_write = 120; + boot_max_time = 600; + boot_idle_time = 60; + boot_known_good_screenshots = []; + boot_graceful_shutdown = 60; + post_boot_test = None; +} + +let failwithf fs = ksprintf failwith fs + +let quote = Filename.quote + +let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () = + let input_disk = + match input_disk with + | None -> test ^ ".img.xz" + | Some input_disk -> input_disk in + let input_xml = + match inpu...