Subject: Re: bug#20117: 25.0.50; Tramp tests failing on Cygwin

From: Michael Albinus <[email-masked]>
Date: Wed, 18 Mar 2015 13:37:01 +0100

Ken Brown <[email-masked]> writes:

>> The following patch let the construct work in all four investigated
>> shells for me, could you pls check?
>
> The test still fails.  New traces attached.

Well, the patch was successful in the sense that the command is accepted
by bash now. But bash doesn't seem to like control characters in its
flow. So let's use "/" as apostroph marker; it is very unlikely that it
is part of any file name :-)

Could you pls test the revised patch?

--8<---------------cut here---------------start------------->8---
*** /tmp/ediff2557DrZ	2015-03-18 13:34:09.986438397 +0100
--- /net/ford/albinus/src/tramp/lisp/tramp-sh.el	2015-03-18 13:32:58.096723817 +0100
***************
*** 1719,1730 ****
       ;; "-"; this would confuse xargs.  "ls -aQ" might be a solution,
       ;; but it does not work on all remote systems.  Therefore, we
       ;; use \000 as file separator.
!      ;; Apostrophes in the stat output are masked as \037 characters, in
       ;; order to make a proper shell escape of them in file names.
       "cd %s && echo \"(\"; (%s %s -a | "
       "xargs %s -c "
!      "'(\037%%n\037 (\037%%N\037) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \037%%A\037 t %%ie0 -1)'"
!      " -- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/\037/\"/g'); echo \")\"")
      (tramp-shell-quote-argument localname)
      (tramp-get-ls-command vec)
      ;; On systems which have no quoting style, file names with
--- 1719,1730 ----
       ;; "-"; this would confuse xargs.  "ls -aQ" might be a solution,
       ;; but it does not work on all remote systems.  Therefore, we
       ;; use \000 as file separator.
!      ;; Apostrophes in the stat output are masked as ?/ characters, in
       ;; order to make a proper shell escape of them in file names.
       "cd %s && echo \"(\"; (%s %s -a | "
       "xargs %s -c "
!      "'(/%%n/ (/%%N/) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 /%%A/ t %%ie0 -1)'"
!      " -- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/\\//\"/g'); echo \")\"")
      (tramp-shell-quote-argument localname)
      (tramp-get-ls-command vec)
      ;; On systems which have no quoting style, file names with
***************
*** 1732,1739 ****
      (if (tramp-get-ls-command-with-quoting-style vec)
  	"--quoting-style=shell" "")
      (tramp-get-remote-stat vec)
!     (if (eq id-format 'integer) "%ue0" "\037%U\037")
!     (if (eq id-format 'integer) "%ge0" "\037%G\037"))))
  
  ;; This function should return "foo/" for directories and "bar" for
  ;; files.
--- 1732,1739 ----
      (if (tramp-get-ls-command-with-quoting-style vec)
  	"--quoting-style=shell" "")
      (tramp-get-remote-stat vec)
!     (if (eq id-format 'integer) "%ue0" "/%U/")
!     (if (eq id-format 'integer) "%ge0" "/%G/"))))
  
  ;; This function should return "foo/" for directories and "bar" for
  ;; files.
--8<---------------cut here---------------end--------------->8---

> Ken

Best regards, Michael.