[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] chroot: fix quoting in cp invocation



Make sure to quote source and destination, to avoid failures when
dealing with paths with e.g. spaces, brackets, etc.
---
 src/chroot.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/chroot.ml b/src/chroot.ml
index 63a5a79..d0ee4c3 100644
--- a/src/chroot.ml
+++ b/src/chroot.ml
@@ -60,7 +60,7 @@ let build_chroot debug files outputdir =
 
         | S_REG | S_CHR | S_BLK | S_FIFO | S_SOCK ->
           if debug >= 2 then printf "supermin: chroot: copy %s\n%!" opath;
-          let cmd = sprintf "cp -p %s %s" path opath in
+          let cmd = sprintf "cp -p %s %s" (quote path) (quote opath) in
           ignore (Sys.command cmd)
       with Unix_error _ -> ()
   ) files;
-- 
1.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]