Displaying 5 results from an estimated 5 matches for "0o170000_l".
Did you mean:
0o100000_l
2016 Sep 30
2
[PATCH] customize: Add --append-line.
...quot;
+ in
+
+ if not (g#exists path) then (
+ g#write path (line ^ default_newline ())
+ )
+ else (
+ (* Stat the file. We want to know it's a regular file, and
+ * also its size.
+ *)
+ let { G.st_mode = mode; st_size = size } = g#statns path in
+ if Int64.logand mode 0o170000_L <> 0o100000_L then
+ error (f_"append_line: %s is not a file") path;
+
+ (* Guess the line ending from the first part of the file, else
+ * use the default for this guest type.
+ *)
+ let newline =
+ let content = g#pread path 8192 0L in
+ if String.find...
2016 Sep 30
0
Re: [PATCH] customize: Add --append-line.
...; Also adds a test.
> ---
Makes sense, just a couple of notes.
> + else (
> + (* Stat the file. We want to know it's a regular file, and
> + * also its size.
> + *)
> + let { G.st_mode = mode; st_size = size } = g#statns path in
> + if Int64.logand mode 0o170000_L <> 0o100000_L then
I guess maybe it could be better to use g#is_file and g#filesize, to
avoid having to deal at application side with the file mode got in the
appliance.
> + (* Guess the line ending from the first part of the file, else
> + * use the default for this guest type...
2017 Sep 25
0
[PATCH] customize: Unconditionally set the machine-id if not set already.
...fail if it is not set.
+ *)
+ let () =
+ let etc_machine_id = "/etc/machine-id" in
+ let statbuf =
+ try Some (g#lstatns etc_machine_id) with G.Error _ -> None in
+ (match statbuf with
+ | Some { G.st_size = 0L; G.st_mode = mode }
+ when (Int64.logand mode 0o170000_L) = 0o100000_L ->
+ message (f_"Setting the machine ID in %s") etc_machine_id;
+ let id = Urandom.urandom_bytes 16 in
+ let id = String.map_chars (fun c -> sprintf "%02x" (Char.code c)) id in
+ let id = String.concat "" id in
+ l...
2017 Oct 04
0
[PATCH 2/9] ocaml: Replace pattern matching { field = field } with { field }.
...d_line.ml
+++ b/customize/append_line.ml
@@ -39,8 +39,8 @@ let append_line (g : G.guestfs) root path line =
(* Stat the file. We want to know it's a regular file, and
* also its size.
*)
- let { G.st_mode = mode; st_size = size } = g#statns path in
- if Int64.logand mode 0o170000_L <> 0o100000_L then
+ let { G.st_mode; st_size = size } = g#statns path in
+ if Int64.logand st_mode 0o170000_L <> 0o100000_L then
error (f_"append_line: %s is not a file") path;
(* Guess the line ending from the first part of the file, else
diff --git a/cus...
2017 Oct 04
11
[PATCH 0/9] build: Require OCaml >= 4.02.
Per my previous email:
https://www.redhat.com/archives/libguestfs/2017-September/msg00203.html
I'd like to talk about requiring a more modern version of the OCaml
compiler.
These commits show some of the code changes which would be possible
with OCaml >= 3.12 [which it turns out we already require by accident]
and also with OCaml >= 4.02. The latter is my favoured option.
Rich.