emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/dockerfile-mode d1e9754285 037/104: Fix build failure when


From: ELPA Syncer
Subject: [nongnu] elpa/dockerfile-mode d1e9754285 037/104: Fix build failure when path of Dockerfile contains spaces.
Date: Sat, 29 Jan 2022 07:58:29 -0500 (EST)

branch: elpa/dockerfile-mode
commit d1e9754285313e962477af17dbc5c6aa04084441
Author: Jacob MacDonald <jaccarmac@gmail.com>
Commit: Jacob MacDonald <jaccarmac@gmail.com>

    Fix build failure when path of Dockerfile contains spaces.
    
    Since the substitutions into the format call were not escaped, the shell
    was interpreting paths with spaces in them as two arguments. Surrounding
    said paths in spaces forces the shell to treat the literal spaces in the
    path as part of the path instaead of a separator. Escaping spaces (" "
    -> "\ ") would probably be a nicer solution, but the code is less
    simple.
---
 dockerfile-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dockerfile-mode.el b/dockerfile-mode.el
index 0e37485848..b992b81957 100644
--- a/dockerfile-mode.el
+++ b/dockerfile-mode.el
@@ -90,7 +90,7 @@
   (save-buffer)
   (if (stringp image-name)
       (async-shell-command
-       (format "%s docker build -t %s -f %s %s" (if dockerfile-use-sudo "sudo" 
"") image-name (buffer-file-name) (file-name-directory (buffer-file-name)))
+       (format "%s docker build -t %s -f \"%s\" \"%s\"" (if 
dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) 
(file-name-directory (buffer-file-name)))
        "*docker-build-output*")
     (print "docker-image-name must be a string, consider surrounding it with 
double quotes")))
 
@@ -104,7 +104,7 @@
   (save-buffer)
   (if (stringp image-name)
       (async-shell-command
-       (format "%s docker build --no-cache -t %s -f %s %s" (if 
dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) 
(file-name-directory (buffer-file-name)))
+       (format "%s docker build --no-cache -t %s -f \"%s\" \"%s\"" (if 
dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) 
(file-name-directory (buffer-file-name)))
        "*docker-build-output*")
     (print "docker-image-name must be a string, consider surrounding it with 
double quotes")))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]