diff lisp/net/tramp-sh.el @ 112238:4f72b1e43644

Merge from emacs-23 branch.
author Glenn Morris <rgm@gnu.org>
date Sat, 15 Jan 2011 12:03:38 -0800
parents 417b1e4d63cd
children 61f7601898b1
line wrap: on
line diff
--- a/lisp/net/tramp-sh.el	Fri Jan 14 22:21:48 2011 -0500
+++ b/lisp/net/tramp-sh.el	Sat Jan 15 12:03:38 2011 -0800
@@ -803,7 +803,7 @@
 (defconst tramp-perl-decode
   "%s -e '
 # This script contributed by Juanma Barranquero <lektu@terra.es>.
-# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   Free Software Foundation, Inc.
 use strict;
 
@@ -4065,9 +4065,17 @@
 	   vec 5
 	   "Checking local compress command `%s', `%s' for sanity"
 	   compress decompress)
-	  (unless (zerop (tramp-call-local-coding-command
-			  (format "echo %s | %s | %s"
-				  magic compress decompress) nil nil))
+	  (unless
+	      (zerop
+	       (tramp-call-local-coding-command
+		(format
+		 ;; Windows shells need the program file name after
+		 ;; the pipe symbol be quoted if they use forward
+		 ;; slashes as directory separators.
+		 (if (memq system-type '(windows-nt))
+		     "echo %s | \"%s\" | \"%s\""
+		   "echo %s | %s | %s")
+		 magic compress decompress) nil nil))
 	    (throw 'next nil))
 	  (tramp-message
 	   vec 5
@@ -4961,9 +4969,25 @@
 	 ((symbolp coding)
 	  coding)
 	 ((and compress (string-match "decoding" prop))
-	  (format "(%s | %s >%%s)" coding compress))
+	  (format
+	   ;; Windows shells need the program file name after
+	   ;; the pipe symbol be quoted if they use forward
+	   ;; slashes as directory separators.
+	   (if (and (string-match "local" prop)
+		    (memq system-type '(windows-nt)))
+	       "(%s | \"%s\" >%%s)"
+	     "(%s | %s >%%s)")
+	   coding compress))
 	 (compress
-	  (format "(%s <%%s | %s)" compress coding))
+	  (format
+	   ;; Windows shells need the program file name after
+	   ;; the pipe symbol be quoted if they use forward
+	   ;; slashes as directory separators.
+	   (if (and (string-match "local" prop)
+		    (memq system-type '(windows-nt)))
+	       "(%s <%%s | \"%s\")"
+	     "(%s <%%s | %s)")
+	   compress coding))
 	 ((string-match "decoding" prop)
 	  (format "%s >%%s" coding))
 	 (t