all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <christian.lynbech@tieto.com>
To: <emacs-devel@gnu.org>
Subject: Robustness problem in tramp.el
Date: Tue, 25 May 2010 14:12:02 +0200	[thread overview]
Message-ID: <ytqpzkzogoz1.fsf@tieto.com> (raw)

[-- 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)

             reply	other threads:[~2010-05-25 12:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-25 12:12 christian.lynbech [this message]
2010-05-25 12:26 ` Robustness problem in tramp.el christian.lynbech
2010-05-25 13:38 ` Michael Albinus
2010-05-25 15:58   ` Chong Yidong
2010-05-25 19:08     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ytqpzkzogoz1.fsf@tieto.com \
    --to=christian.lynbech@tieto.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.