unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Robustness problem in tramp.el
@ 2010-05-25 12:12 christian.lynbech
  2010-05-25 12:26 ` christian.lynbech
  2010-05-25 13:38 ` Michael Albinus
  0 siblings, 2 replies; 5+ messages in thread
From: christian.lynbech @ 2010-05-25 12:12 UTC (permalink / raw)
  To: emacs-devel

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

I have stumbled across a slight problem in `tramp-handle-insert-directory' in
tramp.el.

When operating against a system where `ls' support "--dired", there is
some code to iterate across the line of data tagged with
//DIRED//. However, after seeing the tag (with `looking-at') it uses
among other things `forward-word' to reposition itself which will fail
if the user has modified the default syntax table in certain ways (which
was what I was doing and then was surprised to see tramp fail).

One could perhaps argue that there are some deeply rooted assumptions
about `/' not being a word constituent character but apart from the fact
that I do not believe I have seen it documented anywhere that one cannot
change the default syntax allocations, it is rather silly to have such a
dependency in tramp when it is so easy to have a more robust solution.

I have attached a diff with a proposal for a fix.


[-- Attachment #2: diff --]
[-- Type: application/octet-stream, Size: 732 bytes --]

--- tramp.el.orig	2010-05-25 12:45:04.000000000 +0200
+++ tramp.el.new	2010-05-25 12:46:20.000000000 +0200
@@ -4150,13 +4150,12 @@
 	(forward-line -2)
 	(when (looking-at "//SUBDIRED//")
 	  (forward-line -1))
-	(when (looking-at "//DIRED//")
-	  (let ((end (tramp-compat-line-end-position))
-		(linebeg (point)))
+	(when (looking-at "//DIRED// +")
+	  (let* ((databeg (match-end 0))
+		 (end (tramp-compat-line-end-position))
+		 (linebeg (point)))
 	    ;; Now read the numeric positions of file names.
-	    (goto-char linebeg)
-	    (forward-word 1)
-	    (forward-char 3)
+	    (goto-char databeg)
 	    (while (< (point) end)
 	      (let ((start (+ beg (read (current-buffer))))
 		    (end (+ beg (read (current-buffer)))))

[-- Attachment #3: Type: text/plain, Size: 371 bytes --]



------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)

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

end of thread, other threads:[~2010-05-25 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 12:12 Robustness problem in tramp.el christian.lynbech
2010-05-25 12:26 ` christian.lynbech
2010-05-25 13:38 ` Michael Albinus
2010-05-25 15:58   ` Chong Yidong
2010-05-25 19:08     ` Michael Albinus

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).