diff options
| author | Stefan Monnier | 2018-06-22 11:12:14 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2018-06-22 11:12:14 -0400 |
| commit | 6ffc6a698f5d425e402c35010394cdb17d8888ce (patch) | |
| tree | d765a1aee1c597dde81f189d5e51d4f204a89a6d | |
| parent | e6476c914ebd60971708e0ea0a292e1616d928fd (diff) | |
| download | emacs-6ffc6a698f5d425e402c35010394cdb17d8888ce.tar.gz emacs-6ffc6a698f5d425e402c35010394cdb17d8888ce.zip | |
* lisp/net/tramp-sh.el (tramp-sh--quoting-style-options): New function
(tramp-do-directory-files-and-attributes-with-stat)
(tramp-do-file-attributes-with-ls): Use it.
| -rw-r--r-- | lisp/net/tramp-sh.el | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 26bf3cd0c0c..9bedce78c8c 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1270,6 +1270,13 @@ component is used as the target of the symlink." | |||
| 1270 | ;; The scripts could fail, for example with huge file size. | 1270 | ;; The scripts could fail, for example with huge file size. |
| 1271 | (tramp-do-file-attributes-with-ls v localname id-format))))))))) | 1271 | (tramp-do-file-attributes-with-ls v localname id-format))))))))) |
| 1272 | 1272 | ||
| 1273 | (defun tramp-sh--quoting-style-options (vec) | ||
| 1274 | (or | ||
| 1275 | (tramp-get-ls-command-with | ||
| 1276 | vec "--quoting-style=literal --show-control-chars") | ||
| 1277 | (tramp-get-ls-command-with vec "-w") | ||
| 1278 | "")) | ||
| 1279 | |||
| 1273 | (defun tramp-do-file-attributes-with-ls (vec localname &optional id-format) | 1280 | (defun tramp-do-file-attributes-with-ls (vec localname &optional id-format) |
| 1274 | "Implement `file-attributes' for Tramp files using the ls(1) command." | 1281 | "Implement `file-attributes' for Tramp files using the ls(1) command." |
| 1275 | (let (symlinkp dirp | 1282 | (let (symlinkp dirp |
| @@ -1295,11 +1302,7 @@ component is used as the target of the symlink." | |||
| 1295 | (if (eq id-format 'integer) "-ildn" "-ild") | 1302 | (if (eq id-format 'integer) "-ildn" "-ild") |
| 1296 | ;; On systems which have no quoting style, file names | 1303 | ;; On systems which have no quoting style, file names |
| 1297 | ;; with special characters could fail. | 1304 | ;; with special characters could fail. |
| 1298 | (cond | 1305 | (tramp-sh--quoting-style-options vec) |
| 1299 | ((tramp-get-ls-command-with | ||
| 1300 | vec "--quoting-style=literal --show-control-chars")) | ||
| 1301 | ((tramp-get-ls-command-with vec "-w")) | ||
| 1302 | (t "")) | ||
| 1303 | (tramp-shell-quote-argument localname))) | 1306 | (tramp-shell-quote-argument localname))) |
| 1304 | ;; Parse `ls -l' output ... | 1307 | ;; Parse `ls -l' output ... |
| 1305 | (with-current-buffer (tramp-get-buffer vec) | 1308 | (with-current-buffer (tramp-get-buffer vec) |
| @@ -1828,11 +1831,7 @@ be non-negative integers." | |||
| 1828 | (tramp-get-ls-command vec) | 1831 | (tramp-get-ls-command vec) |
| 1829 | ;; On systems which have no quoting style, file names with special | 1832 | ;; On systems which have no quoting style, file names with special |
| 1830 | ;; characters could fail. | 1833 | ;; characters could fail. |
| 1831 | (cond | 1834 | (tramp-sh--quoting-style-options vec) |
| 1832 | ((tramp-get-ls-command-with | ||
| 1833 | vec "--quoting-style=literal --show-control-chars")) | ||
| 1834 | ((tramp-get-ls-command-with vec "-w")) | ||
| 1835 | (t "")) | ||
| 1836 | (tramp-get-remote-stat vec) | 1835 | (tramp-get-remote-stat vec) |
| 1837 | tramp-stat-marker tramp-stat-marker | 1836 | tramp-stat-marker tramp-stat-marker |
| 1838 | tramp-stat-marker tramp-stat-marker | 1837 | tramp-stat-marker tramp-stat-marker |
| @@ -2632,7 +2631,7 @@ The method used must be an out-of-band method." | |||
| 2632 | filename switches wildcard full-directory-p) | 2631 | filename switches wildcard full-directory-p) |
| 2633 | (when (stringp switches) | 2632 | (when (stringp switches) |
| 2634 | (setq switches (split-string switches))) | 2633 | (setq switches (split-string switches))) |
| 2635 | (when (tramp-get-ls-command-with | 2634 | (when (tramp-get-ls-command-with ;FIXME: tramp-sh--quoting-style-options? |
| 2636 | v "--quoting-style=literal --show-control-chars") | 2635 | v "--quoting-style=literal --show-control-chars") |
| 2637 | (setq switches | 2636 | (setq switches |
| 2638 | (append | 2637 | (append |
| @@ -5334,7 +5333,7 @@ Nonexistent directories are removed from spec." | |||
| 5334 | ;; Check parameters. On busybox, "ls" output coloring is | 5333 | ;; Check parameters. On busybox, "ls" output coloring is |
| 5335 | ;; enabled by default sometimes. So we try to disable it | 5334 | ;; enabled by default sometimes. So we try to disable it |
| 5336 | ;; when possible. $LS_COLORING is not supported there. | 5335 | ;; when possible. $LS_COLORING is not supported there. |
| 5337 | ;; Some "ls" versions are sensible wrt the order of | 5336 | ;; Some "ls" versions are sensitive to the order of |
| 5338 | ;; arguments, they fail when "-al" is after the | 5337 | ;; arguments, they fail when "-al" is after the |
| 5339 | ;; "--color=never" argument (for example on FreeBSD). | 5338 | ;; "--color=never" argument (for example on FreeBSD). |
| 5340 | (when (tramp-send-command-and-check | 5339 | (when (tramp-send-command-and-check |
| @@ -5351,7 +5350,7 @@ Nonexistent directories are removed from spec." | |||
| 5351 | "Return OPTION, if the remote `ls' command supports the OPTION option." | 5350 | "Return OPTION, if the remote `ls' command supports the OPTION option." |
| 5352 | (with-tramp-connection-property vec (concat "ls" option) | 5351 | (with-tramp-connection-property vec (concat "ls" option) |
| 5353 | (tramp-message vec 5 "Checking, whether `ls %s' works" option) | 5352 | (tramp-message vec 5 "Checking, whether `ls %s' works" option) |
| 5354 | ;; Some "ls" versions are sensible wrt the order of arguments, | 5353 | ;; Some "ls" versions are sensitive to the order of arguments, |
| 5355 | ;; they fail when "-al" is after the "--dired" argument (for | 5354 | ;; they fail when "-al" is after the "--dired" argument (for |
| 5356 | ;; example on FreeBSD). Busybox does not support this kind of | 5355 | ;; example on FreeBSD). Busybox does not support this kind of |
| 5357 | ;; options. | 5356 | ;; options. |