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

* bug#21808: Fixed in master
  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 ` Jürgen Hötzel
  2015-11-01 22:26 ` bug#21808: 24.3; tramp sorting with regular expression crashes whole dir listing Michael Albinus
  1 sibling, 0 replies; 4+ messages in thread
From: Jürgen Hötzel @ 2015-11-01 19:26 UTC (permalink / raw)
  To: 21808

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

This is already fixed in the master branch (currently unreleased)

commit ca762806fd6b5b455c42ef85833ff92c791eabe8
Author: Juergen Hoetzel <juergen@archlinux.org>
Date:   Fri Aug 7 18:00:00 2015 +0200

    * tramp-adb.el (tramp-adb-ls-output-name-less-p): Improve error
      checking. "ls -l" on Android in Enforcing mode can print "lstat
      './FILENAME failed: Permission denied".

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

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

* bug#21808: 24.3; tramp sorting with regular expression crashes whole dir listing
  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 ` Michael Albinus
       [not found]   ` <CAGgdw2o+vXDp3hP1Vky7_4aMWO4SxERaEABn=c__4KyV9XUmuw@mail.gmail.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2015-11-01 22:26 UTC (permalink / raw)
  To: Piotr Wasik; +Cc: 21808, Jürgen Hötzel

Piotr Wasik <piotr.wasik@gmail.com> writes:

> hi,

Hi Piotr,

> 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.

Thanks for the bug report. It was already detected by Jürgen Hötzel back
in August, and he fixed it in both the Tramp and Emacs repositories. See
<http://lists.gnu.org/archive/html/emacs-diffs/2015-08/msg00050.html>.

> Cheers,
> Piotr

Best regards, Michael.





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

* bug#21808: 24.3; tramp sorting with regular expression crashes whole dir listing
       [not found]   ` <CAGgdw2o+vXDp3hP1Vky7_4aMWO4SxERaEABn=c__4KyV9XUmuw@mail.gmail.com>
@ 2015-11-01 22:37     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2015-11-01 22:37 UTC (permalink / raw)
  To: Piotr Wasik; +Cc: 21808-done, Jürgen Hötzel

[Please keep Cc for the archives]

Piotr Wasik <piotr.wasik@gmail.com> writes:

> great, thanks.

Well, so I'm closing the bug.

> Piotr

Best regards, Michael.





^ 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.