all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Alex <agrambot@gmail.com>
Cc: 24889@debbugs.gnu.org, Thierry Volpiatto <thierry.volpiatto@gmail.com>
Subject: bug#24889: 25.1; tramp-dissect-file-name signals a user-error for some invalid files
Date: Tue, 08 Nov 2016 20:47:20 +0100	[thread overview]
Message-ID: <87zil94uuv.fsf@gmx.de> (raw)
In-Reply-To: <87twbkqt8p.fsf@gmail.com> (Alex's message of "Sun, 06 Nov 2016 13:54:30 -0600")

Alex <agrambot@gmail.com> writes:

Hi Alex,

> This user-error affects commands such as file-remote-p and ffap. I
> believe that these should just return nil or no valid file instead of
> signalling an error.
>
> Backtrace of (file-remote-p "/uref{http://test.com}":

Thanks for the report. I could reproduce it also with Emacs 24.5.

I've committed the following patch to the master branch, could you pls
check whether this fixes the problem for you?

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs/lisp/net/tramp.el.~3424c27abb7c8ea64c32eaf54cf53fc58323e5ce~	2016-11-08 20:22:58.382424617 +0100
--- /home/albinus/src/emacs/lisp/net/tramp.el	2016-11-08 20:21:39.625098305 +0100
***************
*** 867,890 ****
  See `tramp-file-name-structure' for more explanations.")

  ;;;###autoload
! (defconst tramp-file-name-regexp
    (cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified)
  	((equal tramp-syntax 'sep) tramp-file-name-regexp-separate)
  	(t (error "Wrong `tramp-syntax' defined")))
    "Regular expression matching file names handled by Tramp.
! This regexp should match Tramp file names but no other file names.
! When tramp.el is loaded, this regular expression is prepended to
! `file-name-handler-alist', and that is searched sequentially.  Thus,
! if the Tramp entry appears rather early in the `file-name-handler-alist'
! and is a bit too general, then some files might be considered Tramp
! files which are not really Tramp files.
!
! Please note that the entry in `file-name-handler-alist' is made when
! this file \(tramp.el) is loaded.  This means that this variable must be set
! before loading tramp.el.  Alternatively, `file-name-handler-alist' can be
! updated after changing this variable.
!
! Also see `tramp-file-name-structure'.")

  ;;;###autoload
  (defconst tramp-completion-file-name-regexp-unified
--- 867,880 ----
  See `tramp-file-name-structure' for more explanations.")

  ;;;###autoload
! (defvar tramp-file-name-regexp
    (cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified)
  	((equal tramp-syntax 'sep) tramp-file-name-regexp-separate)
  	(t (error "Wrong `tramp-syntax' defined")))
    "Regular expression matching file names handled by Tramp.
! This regexp should match Tramp file names but no other file
! names.  When calling `tramp-register-file-name-handlers', the
! initial value is overwritten by the car of `tramp-file-name-structure'.")

  ;;;###autoload
  (defconst tramp-completion-file-name-regexp-unified
***************
*** 1055,1063 ****
       . tramp-completion-handle-file-name-all-completions)
      (file-name-completion . tramp-completion-handle-file-name-completion))
    "Alist of completion handler functions.
! Used for file names matching `tramp-file-name-regexp'. Operations
! not mentioned here will be handled by Tramp's file name handler
! functions, or the normal Emacs functions.")

  ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here.
  ;;;###tramp-autoload
--- 1045,1053 ----
       . tramp-completion-handle-file-name-all-completions)
      (file-name-completion . tramp-completion-handle-file-name-completion))
    "Alist of completion handler functions.
! Used for file names matching `tramp-completion-file-name-regexp'.
! Operations not mentioned here will be handled by Tramp's file
! name handler functions, or the normal Emacs functions.")

  ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here.
  ;;;###tramp-autoload
***************
*** 2192,2197 ****
--- 2182,2191 ----
  		 tramp-autoload-file-name-handler))
      (let ((a1 (rassq fnh file-name-handler-alist)))
        (setq file-name-handler-alist (delq a1 file-name-handler-alist))))
+   ;; The initial value of `tramp-file-name-regexp' is too simple
+   ;; minded, but we cannot give it the real value in the autoload
+   ;; pattern.  See Bug#24889.
+   (setq tramp-file-name-regexp (car tramp-file-name-structure))
    ;; Add the handlers.
    (add-to-list 'file-name-handler-alist
  	       (cons tramp-file-name-regexp 'tramp-file-name-handler))
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.





  reply	other threads:[~2016-11-08 19:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-06 19:54 bug#24889: 25.1; tramp-dissect-file-name signals a user-error for some invalid files Alex
2016-11-08 19:47 ` Michael Albinus [this message]
2016-11-08 20:18   ` Alex
2016-11-08 20:22     ` 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=87zil94uuv.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=24889@debbugs.gnu.org \
    --cc=agrambot@gmail.com \
    --cc=thierry.volpiatto@gmail.com \
    /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.