Prevent illegal envvars causing bash syntax errors

This commit is contained in:
Henrik Lissner 2020-08-10 23:05:59 -04:00
parent 85b5103cd9
commit 050ac73789
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -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