summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2011-01-09 19:52:57 +0200
committerEli Zaretskii <eliz@gnu.org>2011-01-09 19:52:57 +0200
commit88ecd0a566155169b0c720d45f6978537e2f4a36 (patch)
tree673c5391b8614eda4f8d5388956cc73a0a802571
parent320912fb3d938746b4a74750f366c6e698e91a34 (diff)
downloademacs-88ecd0a566155169b0c720d45f6978537e2f4a36.tar.gz
Fix bug #6684 with shell pipelines on MS-Windows.
progmodes/grep.el (grep-compute-defaults): Quote the program file name after the pipe symbol in Grep templates. jka-compr.el (jka-compr-partial-uncompress): Likewise. Fixes: debbugs:6784
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/jka-compr.el5
-rw-r--r--lisp/progmodes/grep.el11
3 files changed, 17 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0769c3d4c80..688f32e5a72 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-09 Eli Zaretskii <eliz@gnu.org>
+
+ * progmodes/grep.el (grep-compute-defaults): Quote the program
+ file name after the pipe symbol in Grep templates. (Bug#6784)
+ * jka-compr.el (jka-compr-partial-uncompress): Likewise.
+
2011-01-08 Lennart Borgman <lennart.borgman@gmail.com>
* buff-menu.el (Buffer-menu-buffer-list): New var.
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 635f3ce8468..32f3d6d1f58 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -166,8 +166,11 @@ to keep: LEN chars starting BEG chars from the beginning."
(unwind-protect
(or (memq (call-process
jka-compr-shell infile t nil "-c"
+ ;; Windows shells need the program file name
+ ;; after the pipe symbol be quoted if they use
+ ;; forward slashes as directory separators.
(format
- "%s %s 2> %s | %s bs=%d skip=%d %s 2> %s"
+ "%s %s 2> %s | \"%s\" bs=%d skip=%d %s 2> %s"
prog
(mapconcat 'identity args " ")
err-file
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index dac14d07ef8..dd6dc025d5b 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -561,7 +561,10 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
(unless grep-find-command
(setq grep-find-command
(cond ((eq grep-find-use-xargs 'gnu)
- (format "%s . -type f -print0 | %s -0 -e %s"
+ ;; Windows shells need the program file name
+ ;; after the pipe symbol be quoted if they use
+ ;; forward slashes as directory separators.
+ (format "%s . -type f -print0 | \"%s\" -0 -e %s"
find-program xargs-program grep-command))
((eq grep-find-use-xargs 'exec)
(let ((cmd0 (format "%s . -type f -exec %s"
@@ -572,21 +575,21 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
(shell-quote-argument ";"))
(1+ (length cmd0)))))
(t
- (format "%s . -type f -print | %s %s"
+ (format "%s . -type f -print | \"%s\" %s"
find-program xargs-program grep-command)))))
(unless grep-find-template
(setq grep-find-template
(let ((gcmd (format "%s <C> %s <R>"
grep-program grep-options)))
(cond ((eq grep-find-use-xargs 'gnu)
- (format "%s . <X> -type f <F> -print0 | %s -0 -e %s"
+ (format "%s . <X> -type f <F> -print0 | \"%s\" -0 -e %s"
find-program xargs-program gcmd))
((eq grep-find-use-xargs 'exec)
(format "%s . <X> -type f <F> -exec %s {} %s %s"
find-program gcmd null-device
(shell-quote-argument ";")))
(t
- (format "%s . <X> -type f <F> -print | %s %s"
+ (format "%s . <X> -type f <F> -print | \"%s\" %s"
find-program xargs-program gcmd))))))))
(when (eq grep-highlight-matches 'auto-detect)
(setq grep-highlight-matches