From 050ac737895110f581a19bd6c63b8bc80598da18 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 10 Aug 2020 23:05:59 -0400 Subject: [PATCH] Prevent illegal envvars causing bash syntax errors --- core/core-cli.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/core-cli.el b/core/core-cli.el index 2c903b978..6bc74268f 100644 --- a/core/core-cli.el +++ b/core/core-cli.el @@ -175,14 +175,13 @@ COMMAND, and passes ARGS to it." (coding-system-for-read 'utf-8)) (with-temp-file post-script (insert "#!/usr/bin/env sh\n" - "[ -x \"$0\" ] && rm -f \"$0\"\n" (save-match-data (cl-loop for env in process-environment - if (string-match "^\\([^=]+\\)=\\(.+\\)$" env) + if (string-match "^\\([^ !@#$%^&*()=]+\\)=\\(.+\\)$" env) concat (format "%s=%S\n" (match-string 1 env) (match-string 2 env)))) - "\n" + "\n[ -x \"$0\" ] && rm -f \"$0\"\n" (if (stringp lines) lines (string-join