[latex3-commits] [git/LaTeX3-latex3-l3build] spaces: Fix issue when installing into directory with spaces (8580039)

Marcel Fabian Krüger tex at 2krueger.de
Tue Apr 19 04:09:17 CEST 2022


Repository : https://github.com/latex3/l3build
On branch  : spaces
Link       : https://github.com/latex3/l3build/commit/8580039fa2c15fd037370ac53c99eda95e0a08e3

>---------------------------------------------------------------

commit 8580039fa2c15fd037370ac53c99eda95e0a08e3
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Tue Apr 19 04:08:03 2022 +0200

    Fix issue when installing into directory with spaces


>---------------------------------------------------------------

8580039fa2c15fd037370ac53c99eda95e0a08e3
 l3build-file-functions.lua | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/l3build-file-functions.lua b/l3build-file-functions.lua
index ca39333..4c7764c 100644
--- a/l3build-file-functions.lua
+++ b/l3build-file-functions.lua
@@ -198,7 +198,7 @@ function escapepath(path)
   else
     path = gsub(path,"\\ ","[PATH-SPACE]")
     path = gsub(path," ","\\ ")
-    return gsub(path,"%[PATH-SPACE%]","\\ ")
+    return gsub(path,"%[PATH%-SPACE%]","\\ ")
   end
 end
 
@@ -234,13 +234,13 @@ function cp(glob, source, dest)
     if os_type == "windows" then
       if direxists(p.cwd) then
         errorlevel = execute(
-          'xcopy /y /e /i "' .. unix_to_win(p.cwd) .. '" "'
-             .. unix_to_win(dest .. '/' .. p.src) .. '" > nul'
+          'xcopy /y /e /i "' .. unix_to_win(p.cwd) .. '" '
+             .. unix_to_win(dest .. '/' .. escapepath(p.src)) .. ' > nul'
         ) and 0 or 1
       else
         errorlevel = execute(
-          'xcopy /y "' .. unix_to_win(p.cwd) .. '" "'
-             .. unix_to_win(dest .. '/') .. '" > nul'
+          'xcopy /y "' .. unix_to_win(p.cwd) .. '" '
+             .. unix_to_win(dest .. '/') .. ' > nul'
         ) and 0 or 1
       end
     else
@@ -250,7 +250,7 @@ function cp(glob, source, dest)
         if errorlevel ~=0 then return errorlevel end
       end
       errorlevel = execute(
-        "cp -RLf '" .. p.cwd .. "' '" .. dest .. "'"
+        "cp -RLf '" .. p.cwd .. "' " .. dest
       ) and 0 or 1
     end
     if errorlevel ~=0 then
@@ -367,6 +367,7 @@ function remove_duplicates(a)
 end
 
 function mkdir(dir)
+  dir = escapepath(dir)
   if os_type == "windows" then
     -- Windows (with the extensions) will automatically make directory trees
     -- but issues a warning if the dir already exists: avoid by including a test





More information about the latex3-commits mailing list.