search for: s_dir

Displaying 20 results from an estimated 32 matches for "s_dir".

Did you mean: is_dir
2014 Mar 10
3
[supermin 3/3] Use the file tuple up to the point where files are copied into the filesystem / chroot
...hostfiles) ) in if debug >= 1 then @@ -326,7 +326,9 @@ and isalnum = function * symlink. *) and munge files = - let files = List.sort compare files in + let paths = + List.sort compare + (List.map (fun file -> file.ft_path) files) in let rec stat_is_dir dir = try (stat dir).st_kind = S_DIR with Unix_error _ -> false @@ -336,7 +338,7 @@ and munge files = in let insert_dir, dir_seen = - let h = Hashtbl.create (List.length files) in + let h = Hashtbl.create (List.length paths) in let insert_dir dir = Hashtbl.replace h dir t...
2014 Mar 08
9
supermin and dpkg-divert
While trying to run libguestfs tests after building with "--enable-appliance --with-supermin-extra-options=--use-installed", I ran into a peculiar error message in the c-api test: ,---- | libguestfs: error: strings: /abssymlink: strings: error while loading | shared libraries: libbfd-2.24-multiarch.so: cannot open shared object | file: No such file or directory `---- The problem here
2014 Mar 13
3
[supermin 1/3] Recognize dpkg-divert
--- configure.ac | 1 + src/config.ml.in | 1 + src/dpkg.ml | 1 + 3 files changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 2141540..99ea913 100644 --- a/configure.ac +++ b/configure.ac @@ -92,6 +92,7 @@ AC_PATH_PROG(APT_GET,[apt-get],[no]) AC_PATH_PROG(DPKG,[dpkg],[no]) AC_PATH_PROG(DPKG_DEB,[dpkg-deb],[no]) AC_PATH_PROG(DPKG_QUERY,[dpkg-query],[no])
2014 Mar 15
4
[supermin 1/2] chroot: Fix corner case introduced with dpkg-divert support
...directory permissions in reverse. *) let dirs = filter_map ( fun file -> - let st = lstat file.ft_source_path in + let path = + if file_exists file.ft_source_path then file.ft_source_path + else file.ft_path in + let st = lstat path in if st.st_kind = S_DIR then Some (file.ft_path, st) else None ) files in List.iter ( -- 1.9.0
2011 Sep 12
1
[PATCH] febootstrap: Use contents of installed Debian packages instead of downloading and unpacking them.
...tly describing fs objects such as + "package diverts others to: /path/to/..." *) + let lines = List.filter ( + fun l -> l.[0] = '/' && l.[1] != '.' + ) lines in + let files = List.map ( + fun path -> + let statbuf = lstat path in + let is_dir = statbuf.st_kind = S_DIR in + let config = statbuf.st_kind = S_REG && string_prefix "/etc/" path in + let mode = statbuf.st_perm in + (path, { ft_dir = is_dir; ft_config = config; ft_mode = mode; + ft_ghost = false; ft_size = statbuf.st_size }) + ) lines in...
2017 Jul 14
0
[PATCH 03/27] daemon: Reimplement ‘file’ API in OCaml.
...eturn the + * file type as a string (RHBZ#582484). + *) + if not is_dev then ( + let sysroot = Sysroot.sysroot () in + let chroot = Chroot.create sysroot ~name:(sprintf "file: %s" path) in + + let statbuf = Chroot.f chroot lstat path in + match statbuf.st_kind with + | S_DIR -> "directory" + | S_CHR -> "character device" + | S_BLK -> "block device" + | S_FIFO -> "FIFO" + | S_LNK -> "symbolic link" + | S_SOCK -> "socket" + | S_REG -> + (* Regular file, so now run [fi...
2017 Jul 14
0
[PATCH 07/27] daemon: Reimplement ‘is_dir’, ‘is_file’ and ‘is_symlink’ APIs in OCaml.
...de_t mode; - int r; - - if (!(optargs_bitmask & GUESTFS_IS_FILE_FOLLOWSYMLINKS_BITMASK)) - followsymlinks = 0; - - r = get_mode (path, &mode, followsymlinks); - if (r <= 0) return r; - return S_ISREG (mode); -} - -/* Takes optional arguments, consult optargs_bitmask. */ -int -do_is_dir (const char *path, int followsymlinks) -{ - mode_t mode; - int r; - - if (!(optargs_bitmask & GUESTFS_IS_DIR_FOLLOWSYMLINKS_BITMASK)) - followsymlinks = 0; - - r = get_mode (path, &mode, followsymlinks); - if (r <= 0) return r; - return S_ISDIR (mode); -} - -/* Takes optional ar...
2013 Apr 09
2
[PATCH 1/2] add run_shell helper
The new run_shell helper is a copy of run_python, and will be used by upcoming changes. Signed-off-by: Olaf Hering <olaf at aepfle.de> --- src/supermin_utils.ml | 9 +++++++++ src/supermin_utils.mli | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/src/supermin_utils.ml b/src/supermin_utils.ml index f98e09a..cb8a27e 100644 --- a/src/supermin_utils.ml +++ b/src/supermin_utils.ml
2016 Feb 18
0
[PATCH 3/3] Add and use an helper error function
...quote let quoted_list names = String.concat " " (List.map quote names) +let error ?(exit_code = 1) fs = + let display str = + prerr_endline (sprintf "supermin: %s" str); + exit exit_code + in + ksprintf display fs + let dir_exists name = try (stat name).st_kind = S_DIR with Unix_error _ -> false @@ -59,31 +66,25 @@ let run_command_get_lines cmd = (match stat with | WEXITED 0 -> () | WEXITED i -> - eprintf "supermin: command '%s' failed (returned %d), see earlier error messages\n" cmd i; - exit i + error ~...
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
2014 Feb 25
2
[PATCH supermin v4] Supermin 5 rewrite.
...el debug host_cpu dtb_wildcard copy_kernel kernel dtb in + Ext2.build_ext2 debug basedir files modpath kernel_version appliance; + Ext2_initrd.build_initrd debug tmpdir modpath initrd + +and read_appliance debug basedir appliance = function + | [] -> appliance + + | dir :: rest when Sys.is_directory dir -> + let inputs = Array.to_list (Sys.readdir dir) in + let inputs = List.sort compare inputs in + let inputs = List.map ((//) dir) inputs in + read_appliance debug basedir appliance (inputs @ rest) + + | file :: rest -> + let file_type = get_file_type file in + +...
2017 Jun 03
3
[PATCH 0/3]: daemon: Reimplement ‘file’ API in OCaml.
This patch series is just FYI at the moment. However it does pass the tests. The daemon is a self-contained program. We don't need to write it all in C. Writing parts of it in OCaml would make it simpler and less error-prone. In particular if the daemon was written in a more sane programming language then we could move the inspection code to run entirely inside the appliance, which would
2014 Oct 03
0
[PATCH v3] tests: Introduce test harness for running tests.
...ublic License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* The test-harness standalone program. *) + +open Unix +open Printf + +open Types +open Tests + +let (//) = Filename.concat + +let is_dir path = + try (stat path).st_kind = S_DIR + with Unix_error _ -> false + +let is_file path = + try (stat path).st_kind = S_REG + with Unix_error _ -> false + +let is_executable path = + try (stat path).st_perm land 0o111 <> 0 + with Unix_error _ -> false + +let relative_path_to_...
2014 Oct 05
0
[PATCH v5 1/7] tests: Introduce test harness for running tests.
...es.stdout) () = + if isatty then output_string chan "\x1b[1;31m" +let ansi_blue ?(chan = Pervasives.stdout) () = + if isatty then output_string chan "\x1b[1;34m" +let ansi_restore ?(chan = Pervasives.stdout) () = + if isatty then output_string chan "\x1b[0m" + +let is_dir path = + try (stat path).st_kind = S_DIR + with Unix_error _ -> false + +let is_file path = + try (stat path).st_kind = S_REG + with Unix_error _ -> false + +let is_executable path = + try (stat path).st_perm land 0o111 <> 0 + with Unix_error _ -> false + +let relative_path_to_...
2017 Jul 14
45
[PATCH 00/27] Reimplement many daemon APIs in OCaml.
Previously posted as part of the mega utilities/inspection series here: https://www.redhat.com/archives/libguestfs/2017-June/msg00232.html What I've done is to extract just the parts related to rewriting daemon APIs in OCaml, rebase them on top of the current master, fix a few things, and recompile and test everything. Rich.
2015 Aug 06
0
[PATCH v4 01/17] tests: Introduce test harness for running tests.
...es.stdout) () = + if isatty then output_string chan "\x1b[1;31m" +let ansi_blue ?(chan = Pervasives.stdout) () = + if isatty then output_string chan "\x1b[1;34m" +let ansi_restore ?(chan = Pervasives.stdout) () = + if isatty then output_string chan "\x1b[0m" + +let is_dir path = + try (stat path).st_kind = S_DIR + with Unix_error _ -> false + +let is_file path = + try (stat path).st_kind = S_REG + with Unix_error _ -> false + +let is_executable path = + is_file path && + try access path [X_OK]; true + with Unix_error _ -> false + +let rel...
2017 Jun 03
12
[PATCH v2 00/12] Allow APIs to be implemented in OCaml.
Version 1 was here: https://www.redhat.com/archives/libguestfs/2017-June/msg00003.html This patch series reimplements a few more APIs in OCaml, including some very important core APIs like ?list_filesystems? and ?mount?. All the tests pass after this. The selection of APIs that I have moved may look a little random, but in fact they are all APIs consumed by the inspection code (and some more
2017 Jun 05
19
[PATCH v3 00/19] Allow APIs to be implemented in OCaml.
v2 was here: https://www.redhat.com/archives/libguestfs/2017-June/msg00008.html This series gets as far as a working (and faster) reimplementation of ‘guestfs_list_filesystems’. I also have another patch series on top of this one which reimplements the inspection APIs inside the daemon, but that needs a bit more work still, since inspection turns out to be a very large piece of code. Rich.
2017 Jul 27
23
[PATCH v3 00/23] Reimplement many daemon APIs in OCaml.
I think this fixes everything mentioned: - Added the Optgroups module as suggested. - Remove command temporary files. - Replace command ~flags with ?fold_stdout_on_stderr. - Nest _with_mounted function. - Rebase & retest. Rich.
2017 Jul 21
27
[PATCH v2 00/23] Reimplement many daemon APIs in OCaml.
v1 was posted here: https://www.redhat.com/archives/libguestfs/2017-July/msg00098.html This series now depends on two small patches which I posted separately: https://www.redhat.com/archives/libguestfs/2017-July/msg00207.html https://www.redhat.com/archives/libguestfs/2017-July/msg00209.html v1 -> v2: - Previously changes to generator/daemon.ml were made incrementally through the patch