search for: glob_expand

Displaying 20 results from an estimated 87 matches for "glob_expand".

2016 Feb 03
0
[PATCH 2/3] daemon: glob: add option for not returning dirs with trailing slash
...+++----- gobject/Makefile.inc | 2 ++ po/POTFILES | 1 + 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/daemon/glob.c b/daemon/glob.c index 45fb30f..de615ee 100644 --- a/daemon/glob.c +++ b/daemon/glob.c @@ -26,14 +26,18 @@ #include "actions.h" char ** -do_glob_expand (const char *pattern) +do_glob_expand (const char *pattern, int nodirectoryslash) { int r; glob_t buf = { .gl_pathc = 0, .gl_pathv = NULL, .gl_offs = 0 }; + int flags = GLOB_BRACE; + + if (!nodirectoryslash) + flags |= GLOB_MARK; /* glob(3) in glibc never calls chdir, so this seems...
2012 Sep 21
1
[PATCH] sysprep: handle at jobs in cron-spool operation
...sprep/sysprep_operation_cron_spool.ml b/sysprep/sysprep_operation_cron_spool.ml index 5284660..e96832c 100644 --- a/sysprep/sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -23,6 +23,12 @@ module G = Guestfs let cron_spool_perform g root = Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); + Array.iter g#rm (g#glob_expand "/var/spool/atjobs/*"); + Array.iter g#rm (g#glob_expand "/var/spool/atjobs/.SEQ"); + Array.iter g#rm (g#glob_expand "/var/spool/atspool/*"); + Array.iter g#rm (g#glob_expand "/var/spool/at/*&quo...
2016 Feb 04
2
[PATCH v2 1/2] daemon: glob: add optarg to control trailing slash for dirs
...+++----- gobject/Makefile.inc | 2 ++ po/POTFILES | 1 + 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/daemon/glob.c b/daemon/glob.c index 45fb30f..a22fd33 100644 --- a/daemon/glob.c +++ b/daemon/glob.c @@ -26,14 +26,21 @@ #include "actions.h" char ** -do_glob_expand (const char *pattern) +do_glob_expand (const char *pattern, int directoryslash) { int r; glob_t buf = { .gl_pathc = 0, .gl_pathv = NULL, .gl_offs = 0 }; + int flags = GLOB_BRACE | GLOB_MARK; + + /* GLOB_MARK is default, unless the user explicitly disabled it. */ + if ((optargs_bitmask &am...
2016 Feb 03
6
[PATCH 1/3] sysprep, get-kernel: explicit the Guestfs parameter
....ml +++ b/get-kernel/get_kernel.ml @@ -149,7 +149,7 @@ let rec do_fetch ~transform_fn ~outputdir g root = g#umount_all () -and pick_kernel_files_linux g root = +and pick_kernel_files_linux (g : Guestfs.guestfs) root = (* Get all kernels and initramfses. *) let glob w = Array.to_list (g#glob_expand w) in let kernels = glob "/boot/vmlinuz-*" in diff --git a/sysprep/sysprep_operation_abrt_data.ml b/sysprep/sysprep_operation_abrt_data.ml index d950270..0d94271 100644 --- a/sysprep/sysprep_operation_abrt_data.ml +++ b/sysprep/sysprep_operation_abrt_data.ml @@ -21,7 +21,7 @@ open Comm...
2015 Jul 01
0
[PATCH 3/3] sysprep: rework and fix cron-spool operation (RHBZ#1229305)
...-- a/sysprep/sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -18,19 +18,32 @@ open Sysprep_operation open Common_gettext.Gettext +open Common_utils module G = Guestfs let cron_spool_perform (g : Guestfs.guestfs) root side_effects = - Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); + let is_seq path = + let basename = + try last_part_of path '/' + with Not_found -> path in + basename = ".SEQ" in + let reset f = + if g#is_file f then + (* This should overwrite the file in-place, as it's a very +...
2015 Jul 01
0
[PATCH 2/2] sysprep: rework and fix cron-spool operation (RHBZ#1229305)
...-- a/sysprep/sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -18,19 +18,33 @@ open Sysprep_operation open Common_gettext.Gettext +open Common_utils module G = Guestfs let cron_spool_perform (g : Guestfs.guestfs) root side_effects = - Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); + let is_seq path = + let basename = + match last_part_of path '/' with + | Some x -> x + | None -> path in + basename = ".SEQ" in + let reset f = + if g#is_file f then + (* This should overwrite the file in-plac...
2012 Apr 06
2
[PATCH] virt-sysprep:add logging feature
.../sysprep_operation_cron_spool.ml index e67688b..6bd6ec4 100644 --- a/sysprep/sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -17,11 +17,17 @@ *) open Sysprep_operation +open Utils module G = Guestfs -let cron_spool_perform g root = - Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); +let cron_spool_perform g root show_log = + let files = g#glob_expand "/var/spool/cron/*" in + Array.iter ( + fun glob -> + g#rm glob + logging show_log "Deleted %s" glob + ) files; [] let cron_spool_op = { diff --git a/sy...
2016 Feb 03
0
Re: [PATCH 1/3] sysprep, get-kernel: explicit the Guestfs parameter
...@@ -149,7 +149,7 @@ let rec do_fetch ~transform_fn ~outputdir g root = > > g#umount_all () > > -and pick_kernel_files_linux g root = > +and pick_kernel_files_linux (g : Guestfs.guestfs) root = > (* Get all kernels and initramfses. *) > let glob w = Array.to_list (g#glob_expand w) in > let kernels = glob "/boot/vmlinuz-*" in > diff --git a/sysprep/sysprep_operation_abrt_data.ml b/sysprep/sysprep_operation_abrt_data.ml > index d950270..0d94271 100644 > --- a/sysprep/sysprep_operation_abrt_data.ml > +++ b/sysprep/sysprep_operation_abrt_data.ml &g...
2015 Jul 01
4
[PATCH 1/2] mllib: add and use last_part_of
Collect this small snippet to get the part of a string after the last occurrency of a character; replace with it the current snippets doing the same. Should be just code motion. --- customize/password.ml | 5 +++-- mllib/common_utils.ml | 7 +++++++ mllib/common_utils.mli | 3 +++ sysprep/sysprep_operation_user_account.ml | 5 +++--
2015 Jul 01
5
[PATCH 1/3] mllib: add an optional filter for rm_rf_only_files
This way it is possible to use rm_rf_only_files, but not removing specific files. --- mllib/common_utils.ml | 8 +++++++- mllib/common_utils.mli | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index 516cff3..3737b4c 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -640,13 +640,19 @@ let rmdir_on_exit = *
2014 Jan 21
1
[PATCH 1/2] sysprep: Update comments.
--- sysprep/sysprep_operation.mli | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sysprep/sysprep_operation.mli b/sysprep/sysprep_operation.mli index 61dde72..eb89db4 100644 --- a/sysprep/sysprep_operation.mli +++ b/sysprep/sysprep_operation.mli @@ -16,14 +16,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -(** Structure used to describe sysprep
2016 Aug 18
1
[PATCH] v2v: linux: simplify RPM database cleaning
...index f9aa334..9941750 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -85,9 +85,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps = Linux.augeas_init g; (* Clean RPM database. This must be done early to avoid RHBZ#1143866. *) - let dbfiles = g#glob_expand "/var/lib/rpm/__db.00?" in - let dbfiles = Array.to_list dbfiles in - List.iter g#rm_f dbfiles; + Array.iter g#rm_f (g#glob_expand "/var/lib/rpm/__db.00?"); (* What grub is installed? *) let grub_config, grub = -- 2.7.4
2012 Apr 24
1
[PATCH] sysprep: remove the cache of package manager
...., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + +open Sysprep_operation + +module G = Guestfs + +let package_manager_cache_perform g root = + let packager = g#inspect_get_package_management root in + match packager with + | "yum" -> + let cache = g#glob_expand "/var/cache/yum/*" in + Array.iter ( + fun dir -> + g#rm_rf dir + ) cache; [] + | "apt" -> + let cache = g#glob_expand "/var/cache/apt/archives/*" in + Array.iter ( + fun dir -> + g#rm_rf dir + ) cach...
2017 Sep 22
0
[PATCH v3 13/22] v2v: linux: Properly ignore rpm/dpkg-move-aside kernels.
...inux_bootloaders.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml index 210cce762..00cb5cd19 100644 --- a/v2v/linux_bootloaders.ml +++ b/v2v/linux_bootloaders.ml @@ -319,9 +319,9 @@ object (self) Array.to_list (g#glob_expand "/boot/kernel-*") @ Array.to_list (g#glob_expand "/boot/vmlinuz-*") @ Array.to_list (g#glob_expand "/vmlinuz-*") in - let rex = Str.regexp ".*\\.\\(dpkg-.*|rpmsave|rpmnew\\)$" in + let rex = PCRE.compile "\\.(?:dpkg-.*|rpmsave|rpm...
2002 Feb 14
1
HP/UX 11 bug
...en(argv[*argc]) - 1) == '/') + trailing_slash = 1; + + for (i = 0; i < (maxargs - (*argc)) && i < (int)globbuf.gl_pathc; i++) { + char *mpath; if (i == 0) free(argv[*argc]); - argv[(*argc) + i] = strdup(globbuf.gl_pathv[i]); - if (!argv[(*argc) + i]) out_of_memory("glob_expand"); + mpath = globbuf.gl_pathv[i]; + /* pattern had a trailing '/' and this matching path does not */ + if (trailing_slash && *mpath && (mpath[strlen(mpath) - 1] != '/')) { + argv[(*argc) + i] = malloc(strlen(mpath) + 2); + if (!argv[(*argc) + i]) out_of_m...
2012 Apr 03
1
[PATCH RFC] sysprep:add logging feature
...- a/sysprep/sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -16,12 +16,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) +open Printf open Sysprep_operation module G = Guestfs let cron_spool_perform g root = Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); + eprintf "Deleted /var/spool/cron/*\n"; [] let cron_spool_op = { diff --git a/sysprep/sysprep_operation_dhcp_client_state.ml b/sysprep/sysprep_operation_dhcp_client_state.ml index e3e87cb..18415c5 100644 --- a/sysprep/sysprep_operation_dhcp_client_s...
2005 Jul 29
2
segment fault with 2.6.6 or CVS
...ks if used via ssh or if the daemon is started via ssh. But it crashed in daemon mode (started standalone or by xinetd) Here is the gdb log gdb ... set follow-fork-mode child run --daemon --no-detach Program received signal SIGSEGV, Segmentation fault. [Switching to process 32521] 0x08056577 in glob_expand (base1=0x5 <Address 0x5 out of bounds>, argv_ptr=0xbfa4a20c, argc_ptr=0xbfa4a210, maxargs_ptr=0xbfa4a214) at util.c:548 548 if (!(argv[argc++] = strdup(globbuf.gl_pathv[i]))) (gdb) where #0 0x08056577 in glob_expand (base1=0x5 <Address 0x5 out of bound...
2012 Aug 08
1
[PATCH] sysprep: remove the process accounting log files
...et pacct_log_perform g root = + let typ = g#inspect_get_type root in + let distro = g#inspect_get_distro root in + match typ, distro with + | "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based") -> + let files = g#glob_expand "/var/account/pacct*" in + Array.iter ( + fun file -> + try g#rm file with G.Error _ -> () + ) files; + (try g#touch "/var/account/pacct" with G.Error _ -> ()); + [ `Created_files ] + + | "linux", ("debian"|"ubuntu&quo...
2012 May 09
2
[PATCH 1/2] sysprep: remove ca certificates in the guest
...;/etc/pki/tls/private/*"; + "/etc/pki/tls/certs/*.crt"; ] in + let excepts = [ "/etc/pki/tls/certs/ca-bundle.crt"; + "/etc/pki/tls/certs/ca-bundle.trust.crt"; ] in + List.iter ( + fun path -> + let files = g#glob_expand path in + Array.iter ( + fun file -> + List.iter ( + fun except -> + if file <> except then ( + try g#rm file with G.Error _ -> () + ) + ) excepts; + ) files; + ) paths; + +...
2013 Dec 09
2
[PATCH] sysprep: allow to specify globbing for --delete
...operation_delete.ml +++ b/sysprep/sysprep_operation_delete.ml @@ -27,7 +27,9 @@ let add_paths path = paths := path :: !paths let path_perform g root = let paths = List.rev !paths in - List.iter g#rm_rf paths; + if paths <> [] then ( + List.iter (fun glob -> Array.iter g#rm_rf (g#glob_expand glob)) paths + ); [] let op = { -- 1.8.3.1