Displaying 15 results from an estimated 15 matches for "file_cmd".
2017 Oct 11
2
[PATCH] v2v: -i vmx: Refuse to load a disk image by accident.
If you accidentally point -i vmx at a disk image, it will try to load
the whole thing into memory and crash. Catch this narrow case and
print an error.
However don't fail if ‘file’ is not installed or if we don't know what
the file is.
---
v2v/parse_vmx.ml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/v2v/parse_vmx.ml b/v2v/parse_vmx.ml
index 65d5a0edd..f6c34e2cf
2017 Oct 11
0
Re: [PATCH] v2v: -i vmx: Refuse to load a disk image by accident.
...e:\n%s\n" str;
Hm I'm not sure about this, since we don't do this for other parameters
(e.g. the XML for -i libvirtxml).
Anyway, if a check is deemed needed, my suggestion is to use what Cédric
wrote in its virt-builder-repository implementation:
+let get_mime_type filepath =
+ let file_cmd = "file --mime-type --brief " ^ (quote filepath) in
+ match external_command file_cmd with
+ | [] -> None
+ | line :: _ -> Some line
... using Std_utils.which to check for the presence of `file`,
returning None if not available.
--
Pino Toscano
2017 Oct 11
1
Re: [PATCH] v2v: -i vmx: Refuse to load a disk image by accident.
...39;s probably needed is a more generic mechanism that we can use
where the tools call read_whole_file.
Rich.
> Anyway, if a check is deemed needed, my suggestion is to use what Cédric
> wrote in its virt-builder-repository implementation:
>
> +let get_mime_type filepath =
> + let file_cmd = "file --mime-type --brief " ^ (quote filepath) in
> + match external_command file_cmd with
> + | [] -> None
> + | line :: _ -> Some line
>
> ... using Std_utils.which to check for the presence of `file`,
> returning None if not available.
>
> --
>...
2017 Sep 18
11
[PATCH v9 0/7] virt-builder-repository
Hi there,
Diffs to v8:
* Remove the regex to increment the revision: Index_parser.get_entry()
only handles integers
* Fix Pino's comments
Cédric Bosdonnat (6):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes()
builder: remove useless fish dependency
New tool:
2017 Sep 12
10
[PATCH v8 0/7] virt-builder-repository tool
Hi all,
Here is the latest iteration on the virt-builder-repository
series. Diffs to previous version are: fixing things mentioned
by Pino, integrate Pino's osinfo ocaml iterator and adding a
check of the mime type to filter potential image files.
Cédric Bosdonnat (6):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry
2017 Sep 18
0
[PATCH v9 7/7] New tool: virt-builder-repository
...let file_flags = [ Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ] in
+ let outfd = Unix.openfile outimg file_flags 0o666 in
+ let res = run_command cmd ~stdout_chan:outfd in
+ if res <> 0 then
+ error (f_"i‘xz’ command failed");
+ outimg
+
+let get_mime_type filepath =
+ let file_cmd = "file --mime-type --brief " ^ (quote filepath) in
+ match external_command file_cmd with
+ | [] -> ""
+ | lines -> List.hd lines
+
+let get_disk_image_info filepath =
+ let qemuimg_cmd = "qemu-img info --output json " ^ (quote filepath) in
+ let lines = ex...
2017 Oct 05
0
[PATCH v11 6/6] New tool: virt-builder-repository
...+ let file_flags = [ Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ] in
+ let outfd = Unix.openfile outimg file_flags 0o666 in
+ let res = run_command cmd ~stdout_chan:outfd in
+ if res <> 0 then
+ error (f_"‘xz’ command failed");
+ outimg
+
+let get_mime_type filepath =
+ let file_cmd = "file --mime-type --brief " ^ (quote filepath) in
+ match external_command file_cmd with
+ | [] -> None
+ | line :: _ -> Some line
+
+let get_disk_image_info filepath =
+ let qemuimg_cmd = "qemu-img info --output json " ^ (quote filepath) in
+ let lines = external_c...
2017 Sep 12
0
[PATCH v8 7/7] Add a virt-builder-repository tool
...ile_flags = [ Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ] in
+ let outfd = Unix.openfile outimg file_flags 0o666 in
+ let res = run_command cmd ~stdout_chan:outfd in
+ if res <> 0 then
+ error (f_"'xz' command failed");
+ outimg
+
+let get_mime_type filepath =
+ let file_cmd = "file --mime-type " ^ (quote filepath) in
+ let output = List.hd (external_command file_cmd) in
+ let _, mime = String.split ":" output in
+ String.trim mime
+
+let get_disk_image_info filepath =
+ let qemuimg_cmd = "qemu-img info --output json " ^ (quote filepat...
2017 Nov 14
1
Re: [PATCH v12 3/3] New tool: virt-builder-repository
...t'd be nice to use with_openfile, if it was upstream.
https://www.redhat.com/archives/libguestfs/2017-November/msg00028.html
Pino ^ x 2 ?
> + if res <> 0 then
> + error (f_"‘xz’ command failed");
> + outimg
> +
> +let get_mime_type filepath =
> + let file_cmd = "file --mime-type --brief " ^ (quote filepath) in
Don't need parens.
> +let cmp a b =
> + let string_of_arch = function Index.Arch s -> s | Index.GuessedArch s -> s in
> + (string_of_arch a) = (string_of_arch b)
You don't need parens here.
If you define Inde...
2017 Nov 13
0
[PATCH v12 3/3] New tool: virt-builder-repository
...+ let file_flags = [ Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ] in
+ let outfd = Unix.openfile outimg file_flags 0o666 in
+ let res = run_command cmd ~stdout_chan:outfd in
+ if res <> 0 then
+ error (f_"‘xz’ command failed");
+ outimg
+
+let get_mime_type filepath =
+ let file_cmd = "file --mime-type --brief " ^ (quote filepath) in
+ match external_command file_cmd with
+ | [] -> None
+ | line :: _ -> Some line
+
+let get_disk_image_info filepath =
+ let infos = get_image_infos filepath in
+ {
+ format = object_get_string "format" infos;
+...
2017 Nov 13
6
[PATCH v12 0/3] virt-builder-repository tool
Hi there!
Here is the latest version of the series including Richard's comments.
I also reworked the repository_main.ml code to avoid setting an
empty entry if not found.
Cédric Bosdonnat (3):
builder: change arch type to distinguish guesses
builder: add a template parameter to get_index
New tool: virt-builder-repository
.gitignore | 4 +
2017 Sep 20
6
[PATCH v10 0/6] virt-builder-repository
Hi all,
Diff to v9 includes the changes requested by Pino.
Cédric Bosdonnat (5):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes()
New tool: virt-builder-repository
Pino Toscano (1):
builder: add simple OCaml osinfo-db reader
.gitignore
2017 Nov 21
5
[PATCH v13 0/3] virt-builder-repository
Hey there,
Here is an update of the series. The changes:
* Incorporate Richard's comments. Left out the with_openfile one
since that leads to a double close.
* Change the ask option return type to string (removing the option)
since if the use doesn't input anything we're using the default,
and the default is now a mandatory parameter.
* Make sure there are items in the
2017 Oct 05
14
[PATCH v11 0/6] virt-builder-repository
Hi there,
This is an update of the series. Just to rebase it on top of
Rich's latest changes.
Cédric Bosdonnat (5):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes()
New tool: virt-builder-repository
Pino Toscano (1):
builder: add simple OCaml osinfo-db reader
2017 Oct 27
15
[PATCH v11 0/8] virt-builder-repository
Hi all,
Here is the latest version of the series.
Diffs to v10:
* Make Index.arch a (string, string option) maybe and use it
to guess arch at parse time
* Compute the image size at parse time when the template flag
is set and the value is missing.
* Add virt-repository_main slow test
* Other fixes from Richard's comments
Cédric Bosdonnat (7):
Ignore builder/*.out and *.img