summaryrefslogtreecommitdiff
path: root/test/lisp/subr-tests.el
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2018-02-06 13:17:07 -0500
committerNoam Postavsky <npostavs@gmail.com>2018-02-08 19:10:11 -0500
commit2dd273b9853189f2105426cffa723ced7f329fb4 (patch)
treeeff0676ce2be65d138af426c5341336b1f00023f /test/lisp/subr-tests.el
parent19fa6d561abd91e9ad71a6799c5ed4f582c9f351 (diff)
downloademacs-2dd273b9853189f2105426cffa723ced7f329fb4.tar.gz
Mention that shell quoting of % on w32 may fail (Bug#19350)
* doc/lispref/os.texi (Security Considerations): Mention that quoting of '%' assumes no '^' in variable names. * test/lisp/subr-tests.el (shell-quote-argument-%-on-w32): New test, demonstrating what doesn't work.
Diffstat (limited to 'test/lisp/subr-tests.el')
-rw-r--r--test/lisp/subr-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index efafdcf8325..430d719037f 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -307,5 +307,22 @@ cf. Bug#25477."
(should (eq (string-to-char (symbol-name (gensym))) ?g))
(should (eq (string-to-char (symbol-name (gensym "X"))) ?X)))
+(ert-deftest shell-quote-argument-%-on-w32 ()
+ "Quoting of `%' in w32 shells isn't perfect.
+See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350."
+ :expected-result :failed
+ (skip-unless (and (fboundp 'w32-shell-dos-semantics)
+ (w32-shell-dos-semantics)))
+ (let ((process-environment (append '("ca^=with-caret"
+ "ca=without-caret")
+ process-environment)))
+ ;; It actually results in
+ ;; without-caret with-caret
+ (should (equal (shell-command-to-string
+ (format "echo %s %s"
+ "%ca%"
+ (shell-quote-argument "%ca%")))
+ "without-caret %ca%"))))
+
(provide 'subr-tests)
;;; subr-tests.el ends here