Displaying 20 results from an estimated 164 matches for "invalid_argu".
Did you mean:
invalid_arg
2016 Aug 05
3
[PATCH] v2v: do not hide the error, rather report it
The Invalid_argument exception is there to catch unexpected situation
when rpm returns no output. Such situation should be reported rather
then hidden.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
---
v2v/linux.ml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/v2v/linux.m...
2017 Sep 22
0
[PATCH v3 01/22] common/mlpcre: Raise Invalid_argument if PCRE.sub n parameter is negative.
...@ guestfs_int_pcre_sub (value nv)
if (m == NULL)
raise_pcre_error ("PCRE.sub called without calling PCRE.matches", 0);
- len = pcre_get_substring (m->subject, m->vec, m->r, Int_val (nv),
- (const char **) &str);
+ if (n < 0)
+ caml_invalid_argument ("PCRE.sub: n must be >= 0");
+
+ len = pcre_get_substring (m->subject, m->vec, m->r, n, (const char **) &str);
if (len == PCRE_ERROR_NOSUBSTRING)
caml_raise_not_found ();
diff --git a/common/mlpcre/pcre_tests.ml b/common/mlpcre/pcre_tests.ml
index e5214eab8...
2016 Aug 03
1
Re: [PATCH] v2v: fixed file_owner function
...= g#command_lines cmd in
> > + pkgs.(0)
> > with Guestfs.Error msg as exn ->
> > if String.find msg "is not owned" >= 0 then
> > raise Not_found
> > else
> > raise exn
> > + | Invalid_argument msg ->
> > + raise Not_found
>
> My concern/confusion about this patch is what raises Invalid_argument?
>
> I'm assuming it's the array index, which could raise `Invalid_argument
> "index out of bounds"' if the g#command_lines returns...
2016 Aug 01
3
[PATCH] v2v: fixed file_owner function
..._list cmd));
- (try g#command cmd
+ (try
+ let pkgs = g#command_lines cmd in
+ pkgs.(0)
with Guestfs.Error msg as exn ->
if String.find msg "is not owned" >= 0 then
raise Not_found
else
raise exn
+ | Invalid_argument msg ->
+ raise Not_found
)
| format ->
--
2.9.2
2017 Sep 19
1
Re: [PATCH v12 08/11] daemon: Implement inspection types and utility functions.
...> + eprintf "parse_version_from_major_minor: parsing '%s'\n%!" str;
> +
> + if PCRE.matches re_major_minor str ||
> + PCRE.matches re_major_no_minor str then (
> + let major =
> + try Some (int_of_string (PCRE.sub 1))
> + with Not_found | Invalid_argument _ | Failure _ -> None in
> + let minor =
> + try Some (int_of_string (PCRE.sub 2))
> + with Not_found | Invalid_argument _ | Failure _ -> None in
> + match major, minor with
> + | None, None
> + | None, Some _ -> ()
> + | Some major, None -...
2016 Aug 03
0
Re: [PATCH] v2v: fixed file_owner function
...(try
> + let pkgs = g#command_lines cmd in
> + pkgs.(0)
> with Guestfs.Error msg as exn ->
> if String.find msg "is not owned" >= 0 then
> raise Not_found
> else
> raise exn
> + | Invalid_argument msg ->
> + raise Not_found
My concern/confusion about this patch is what raises Invalid_argument?
I'm assuming it's the array index, which could raise `Invalid_argument
"index out of bounds"' if the g#command_lines returns a zero-length
list, but then my...
2016 Aug 05
0
Re: [PATCH] v2v: do not hide the error, rather report it
On Fri, Aug 05, 2016 at 11:32:27AM +0200, Tomáš Golembiovský wrote:
> The Invalid_argument exception is there to catch unexpected situation
> when rpm returns no output. Such situation should be reported rather
> then hidden.
>
> Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
> ---
> v2v/linux.ml | 4 ++--
> 1 file changed, 2 insertions(+), 2 del...
2017 Sep 22
0
[PATCH v3 02/22] common/mlpcre: Add PCRE.subi to return indexes instead of the substring.
...}
+
+value
+guestfs_int_pcre_subi (value nv)
+{
+ CAMLparam1 (nv);
+ int n = Int_val (nv);
+ CAMLlocal1 (rv);
+ struct last_match *m = gl_tls_get (last_match);
+
+ if (m == NULL)
+ raise_pcre_error ("PCRE.subi called without calling PCRE.matches", 0);
+
+ if (n < 0)
+ caml_invalid_argument ("PCRE.subi: n must be >= 0");
+
+ /* eg if there are 2 captures, m->r == 3, and valid values of n are
+ * 0, 1 or 2.
+ */
+ if (n >= m->r)
+ caml_raise_not_found ();
+
+ rv = caml_alloc (2, 0);
+ Store_field (rv, 0, Val_int (m->vec[n*2]));
+ Store_field (rv...
2017 Oct 19
1
[PATCH] v2v: Fix RPM file owned test (RHBZ#1503958).
...- else
- raise exn in
- if Array.length lines = 0 then
- error (f_"internal error: file_owner: dpkg command returned no output");
- let line = lines.(0) in
- let line =
- try String.sub line 0 (String.rindex line ':')
- with Invalid_argument _ ->
- error (f_"internal error: file_owner: invalid dpkg output: ‘%s’")
- line in
- fst (String.split "," line)
-
| "rpm" ->
- (* Although it is possible in RPM for multiple packages to own
- * a file, this delibera...
2016 Jul 11
0
Re: [PATCH v2] OCaml tools: add and use a Getopt module
...C-safe as far as I can tell.
> +let parse_argv argv specs ?anon_fun usage_msg =
> + (* Sanity check the input *)
> + let validate_key key =
> + if String.length key == 0 || key == "-" || key == "--"
> + || key.[0] != '-' then
> + raise (Invalid_argument (sprintf "invalid option key: '%s'" key))
Whereever you've written 'raise (Invalid_argument ...)' you can
replace it with 'invalid_arg ...'.
> + let specs = specs @ [
> + (* Handled internally by getopt_parse. *)
> + [ "-h"; &quo...
2016 Aug 08
1
[PATCH] v2v: disk: strip only common extension (RHBZ#1365005)
...ml
+++ b/v2v/input_disk.ml
@@ -42,9 +42,13 @@ class input_disk input_format disk = object
* the filename passed in. Users can override this using the
* `-on name' option.
*)
- let name = Filename.basename disk in
let name =
- try Filename.chop_extension name with Invalid_argument _ -> name in
+ let name = Filename.basename disk in
+ let ext = last_part_of name '.' in
+ (* Remove the extension, only if it's one usually used for disk images. *)
+ match ext with
+ | Some ("img"|"qcow2"|"raw"|"vmdk&q...
2016 Aug 08
1
[PATCH v2] v2v: disk: strip only common extension (RHBZ#1365005)
...ml
+++ b/v2v/input_disk.ml
@@ -42,9 +42,23 @@ class input_disk input_format disk = object
* the filename passed in. Users can override this using the
* `-on name' option.
*)
- let name = Filename.basename disk in
let name =
- try Filename.chop_extension name with Invalid_argument _ -> name in
+ let name = Filename.basename disk in
+ (* Remove the extension (or suffix), only if it's one usually
+ * used for disk images. *)
+ let suffixes = [
+ ".img"; ".qcow2"; ".raw"; ".vmdk";
+ "-sda...
2015 Mar 18
0
[PATCH 2/2] builder: support for download resume
...gress_bar ?continue:(Some true) ~proxy uri filename;
(filename, false)
-and download_to ~prog t ?(progress_bar = false) ~proxy uri filename =
+and download_to ~prog t ?(progress_bar = false) ?(continue = false) ~proxy uri filename =
let parseduri =
try URI.parse_uri uri
with Invalid_argument "URI.parse_uri" ->
@@ -82,7 +82,6 @@ and download_to ~prog t ?(progress_bar = false) ~proxy uri filename =
* atomically rename it to the final filename.
*)
let filename_new = filename ^ "." ^ string_random8 () in
- unlink_on_exit filename_new;
(match pars...
2018 Aug 17
0
[PATCH v3 1/4] mltools: Rename Yajl module as JSON_parser and move to common/mltools.
...ay"
+ | JSON_parser_bool _ -> "bool"
let type_mismatch_string exp value =
- Printf.sprintf "value is not %s but %s" exp (string_of_yajl_val_type value)
+ Printf.sprintf "value is not %s but %s" exp (string_of_json_parser_val_type value)
let assert_raises_invalid_argument str =
(* Replace the Invalid_argument string with a fixed one, just to check
@@ -44,37 +44,37 @@ let assert_raises_invalid_argument str =
*)
let mock = "parse_error" in
let wrapped_tree_parse str =
- try yajl_tree_parse str
+ try json_parser_tree_parse str
with...
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 =
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)
}
2016 Jul 18
0
[PATCH 3/3] builder: improve the handling of list formats
...t_set_format arg =
- list_format := match arg with
- | "short" -> `Short
- | "long" -> `Long
- | "json" -> `Json
- | fmt ->
- error (f_"invalid --list-format type '%s', see the man page") fmt in
+ (* Do not catch the Invalid_argument that list_format_of_string
+ * throws on invalid input, as it is already checked by the
+ * Getopt handling of Symbol. *)
+ list_format := List_entries.list_format_of_string arg in
let machine_readable = ref false in
@@ -118,6 +116,9 @@ let parse_cmdline () =
let sync = ref...
2016 Jul 18
4
[PATCH 1/3] mllib: Getopt: point to man page as additional help
On error, point also to the man page of the current tool in addition to
'$TOOL --help'.
---
mllib/getopt-c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mllib/getopt-c.c b/mllib/getopt-c.c
index bf40f91..3efd5d3 100644
--- a/mllib/getopt-c.c
+++ b/mllib/getopt-c.c
@@ -69,8 +69,8 @@ cleanup_option_list (void *ptr)
static void __attribute__((noreturn))
2017 Feb 02
2
[PATCH v2] resize: support non-local output disks (RHBZ#1404182)
...e/resize.ml
@@ -315,6 +315,13 @@ read the man page virt-resize(1).
error (f_"error parsing URI '%s'. Look for error messages printed above.")
infile in
+ (* outfile can be a URI. *)
+ let outfile =
+ try (outfile, URI.parse_uri outfile)
+ with Invalid_argument "URI.parse_uri" ->
+ error (f_"error parsing URI '%s'. Look for error messages printed above.")
+ outfile in
+
infile, outfile, align_first, alignment, copy_boot_loader,
deletes,
dryrun, expand, expand_content, extra_partition, forma...
2015 Mar 18
5
[PATCH 0/2] [RFE] virt-builder should support download resume
This patchset adds support for resuming downloads in virt-builder.
Partially downloaded file is not deleted on exit anymore.
There is a check for partially downloaded image in cache directory
based on its name. When found, download_to crafts appropriate
options to continue its download.
Maros Zatko (2):
mllib: allow external_command to return [] on nonzero return value
builder: support for