Subject: bug#37228: [PATCH] tramp: dired for files which name contains spaces

From: Koichi Arakawa <[email-masked]>
Date: Fri, 30 Aug 2019 14:28:04 +0900 (東京 (標準時))

Hi,

It seems for me that the current version of tramp does not handle
dired properly for files which name contains spaces.

How about using the '-0' option of xargs?

Regards,
Koichi Arakawa

--- tramp-sh.el.~1~	2019-08-28 07:24:07.781000000 +0900
+++ tramp-sh.el	2019-08-30 13:59:34.747676700 +0900
@@ -1762,8 +1762,8 @@
        ;; Apostrophes in the stat output are masked as
        ;; `tramp-stat-marker', in order to make a proper shell escape
        ;; of them in file names.
-       "cd %s && echo \"(\"; (%s %s -a | "
-       "xargs %s -c "
+       "cd %s && echo \"(\"; (%s %s -a | tr '\\n' '\\0' | "
+       "xargs -0 %s -c "
        "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
        "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\""))
     (tramp-shell-quote-argument localname)