aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoichi Arakawa2019-08-30 13:53:56 +0200
committerMichael Albinus2019-08-30 13:53:56 +0200
commitcea78adf7c57e82f1343c7a004cd4053d2e312a6 (patch)
tree0ac2f3fc3ed57c2499bb40d3b5e58999856a688f
parent44f15b63dbe9a45921573197e08c8aaaed08412a (diff)
downloademacs-cea78adf7c57e82f1343c7a004cd4053d2e312a6.tar.gz
emacs-cea78adf7c57e82f1343c7a004cd4053d2e312a6.zip
Fix Tramp's directory-files-and-attributes-with-stat (Bug#37228)
* lisp/net/tramp-sh.el (tramp-do-directory-files-and-attributes-with-stat): Handle file names with spaces. (Bug#37228) Copyright-paperwork-exempt: yes
-rw-r--r--lisp/net/tramp-sh.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 217e73a24bc..bcfac78ee65 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1759,11 +1759,14 @@ of."
1759 ;; We must care about file names with spaces, or starting with 1759 ;; We must care about file names with spaces, or starting with
1760 ;; "-"; this would confuse xargs. "ls -aQ" might be a 1760 ;; "-"; this would confuse xargs. "ls -aQ" might be a
1761 ;; solution, but it does not work on all remote systems. 1761 ;; solution, but it does not work on all remote systems.
1762 ;; Therefore, we use \000 as file separator.
1763 ;; `tramp-sh--quoting-style-options' do not work for file names
1764 ;; with spaces piped to "xargs".
1762 ;; Apostrophes in the stat output are masked as 1765 ;; Apostrophes in the stat output are masked as
1763 ;; `tramp-stat-marker', in order to make a proper shell escape 1766 ;; `tramp-stat-marker', in order to make a proper shell escape
1764 ;; of them in file names. 1767 ;; of them in file names.
1765 "cd %s && echo \"(\"; (%s %s -a | " 1768 "cd %s && echo \"(\"; (%s %s -a | tr '\\n\\r' '\\000\\000' | "
1766 "xargs %s -c " 1769 "xargs -0 %s -c "
1767 "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' " 1770 "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
1768 "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"")) 1771 "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\""))
1769 (tramp-shell-quote-argument localname) 1772 (tramp-shell-quote-argument localname)