all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21808: 24.3; tramp sorting with regular expression crashes whole dir listing
@ 2015-11-01 15:49 Piotr Wasik
  2015-11-01 19:26 ` bug#21808: Fixed in master Jürgen Hötzel
  2015-11-01 22:26 ` bug#21808: 24.3; tramp sorting with regular expression crashes whole dir listing Michael Albinus
  0 siblings, 2 replies; 4+ messages in thread
From: Piotr Wasik @ 2015-11-01 15:49 UTC (permalink / raw)
  To: 21808

[-- Attachment #1: Type: text/plain, Size: 1786 bytes --]

hi,

I try to set up tramp with adb to access nexus. Its root directory contains
a protected file called factory and directory listing returns: "lstat
'//factory' failed: Permission denied" as one of files.

it crashes with the following backtrace
;; Debugger entered--Lisp error: (args-out-of-range "lstat '//factory'
failed: Permission denied" 55 43)
;;   tramp-adb-ls-output-name-less-p("lstat '//factory' failed: Permission
denied" "lrwxrwxrwx root     root            0 2015-11-01 13:49 etc ->
/system/etc")
;;   sort(("drwxr-xr-x root     root            0 2015-11-01 13:49 acct"
"drwxrwx--- system   cache           0 2015-11-01 15:03 cache" "lrwxrwxrwx
root     root            0 1970-01-01 01:00 charger -> /sbin/healthd"
"dr-x------ root     root            0 2015-11-01 13:49 config" "lrwxrwxrwx
root     root            0 2015-11-01 13:49 d -> /sys/kernel/debug")
tramp-adb-ls-output-name-less-p)
;;   tramp-adb-sh-fix-ls-output()
;;   tramp-adb-handle-directory-files-and-attributes("/adb::/")
;;   eval((tramp-adb-handle-directory-files-and-attributes "/adb::/") nil)
;;   eval-last-sexp-1(t)
;;   eval-last-sexp(t)
;;   eval-print-last-sexp()
;;   call-interactively(eval-print-last-sexp nil nil)

I suggest a fix:

(defun tramp-adb-ls-output-name-less-p (a b)
  "Sort \"ls\" output by name, ascending."
  (let (posa posb matched-a matched-b)
    (setq matched-a (string-match dired-move-to-filename-regexp a))
    (setq posa (match-end 0))
    (setq matched-b (string-match dired-move-to-filename-regexp b))
    (setq posb (match-end 0))
    (string-lessp (substring a (if matched-a a 0)) (substring b (if
matched-b b 0)))))

I added matched-a and matched-b variables so even if directory listing
returns something unexpected, sorting completes normally.

Cheers,
Piotr

[-- Attachment #2: Type: text/html, Size: 2400 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-01 22:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-01 15:49 bug#21808: 24.3; tramp sorting with regular expression crashes whole dir listing Piotr Wasik
2015-11-01 19:26 ` bug#21808: Fixed in master Jürgen Hötzel
2015-11-01 22:26 ` bug#21808: 24.3; tramp sorting with regular expression crashes whole dir listing Michael Albinus
     [not found]   ` <CAGgdw2o+vXDp3hP1Vky7_4aMWO4SxERaEABn=c__4KyV9XUmuw@mail.gmail.com>
2015-11-01 22:37     ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.