GNU bug report logs - #11714
24.1.50; find-file completion on a remote directory

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Fri, 15 Jun 2012 07:56:01 UTC

Severity: normal

Merged with 11628

Found in version 24.1.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Michael Albinus <michael.albinus <at> gmx.de>
Subject: bug#11628: closed (Re: bug#11714: 24.1.50; find-file completion
 on a remote directory)
Date: Sat, 23 Jun 2012 03:58:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#11714: 24.1.50; "Assertion failed: (equal (funcall unquote qstring) completion)" when completing remote file names

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 11628 <at> debbugs.gnu.org.

-- 
11714: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11714
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 11714-done <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#11714: 24.1.50; find-file completion on a remote directory
Date: Fri, 22 Jun 2012 23:49:46 -0400
>> Recipe from "emacs -Q":
>> 1. Eval: (cd "/some-user <at> some-host:~")
>> 2. Give the correct password.
>> 3. Type: C-x C-f / h o m e / s o m e - u s e r / t TAB

I just fixed this in the trunk with the patch below.


        Stefan


=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el  2012-06-18 20:39:52 +0000
+++ lisp/minibuffer.el  2012-06-23 03:46:25 +0000
@@ -488,7 +488,7 @@
 
 (defun completion--twq-try (string ustring completion point
                                    unquote requote)
-  ;; Basically two case: either the new result is
+  ;; Basically two cases: either the new result is
   ;; - commonprefix1 <point> morecommonprefix <qpos> suffix
   ;; - commonprefix <qpos> newprefix <point> suffix
   (pcase-let*
@@ -505,8 +505,13 @@
          ((> point (length prefix)) (+ qpos (length qstr1)))
          (t (car (funcall requote point string))))))
     ;; Make sure `requote' worked.
-    (assert (equal (funcall unquote qstring) completion))
-    (cons qstring qpoint)))
+    (if (equal (funcall unquote qstring) completion)
+       (cons qstring qpoint)
+      ;; If requote failed (e.g. because sifn-requote did not handle
+      ;; Tramp's "/foo:/bar//baz -> /foo:/baz" truncation), then at least
+      ;; try requote properly.
+      (let ((qstr (funcall qfun completion)))
+       (cons qstr (length qstr))))))
 
 (defun completion--string-equal-p (s1 s2)
   (eq t (compare-strings s1 nil nil s2 nil nil 'ignore-case)))
@@ -2130,6 +2135,12 @@
   ;; find the position corresponding to UPOS in QSTR, but
   ;; substitute-in-file-name can do anything, depending on file-name-handlers.
   ;; Kind of like in rfn-eshadow-update-overlay, only worse.
+  ;; FIXME: example of thing we do not handle: Tramp's makes
+  ;; (substitute-in-file-name "/foo:~/bar//baz") -> "/scpc:foo:/baz".
+  ;; FIXME: One way to try and handle "all" cases is to require
+  ;; substitute-in-file-name to preserve text-properties, so we could
+  ;; apply text-properties to the input string and then look for them in
+  ;; the output to understand what comes from where.
   (let ((qpos 0))
     ;; Handle substitute-in-file-name's truncation behavior.
     (let (tpos)
@@ -2824,14 +2835,14 @@
 
 (defun completion--sreverse (str)
   "Like `reverse' but for a string STR rather than a list."
-  (apply 'string (nreverse (mapcar 'identity str))))
+  (apply #'string (nreverse (mapcar 'identity str))))
 
 (defun completion--common-suffix (strs)
   "Return the common suffix of the strings STRS."
   (completion--sreverse
    (try-completion
     ""
-    (mapcar 'completion--sreverse strs))))
+    (mapcar #'completion--sreverse strs))))
 
 (defun completion-pcm--merge-completions (strs pattern)
   "Extract the commonality in STRS, with the help of PATTERN.


[Message part 3 (message/rfc822, inline)]
From: Michael Albinus <michael.albinus <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1.50;
	"Assertion failed: (equal (funcall unquote qstring) completion)" when
	completing remote file names
Date: Mon, 04 Jun 2012 16:44:49 +0200
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

The error message looks identical to bug#11466. That bug has been
reported as fixed, buth with the following scenario the problem still exist:

emacs
C-c C-f /ssh:: <RET>
password <RET>
C-c C-f /tm <TAB>

-> Debugger entered--Lisp error: (cl-assertion-failed (equal (funcall unquote qstring) completion))
  signal(cl-assertion-failed ((equal (funcall unquote qstring) completion)))
  completion--twq-try("/ssh:detlef:/home/albinus//tm" "/ssh:detlef:/tm" "/ssh:detlef:/tmp/" 17 substitute-in-file-name completion--sifn-requote)
  #[514 "\211\304=\203\242;\204\207\305\302\303 <at> A\300\301&\207\211\306=\203<\307!\211A\206)\310\205;\311\241\210\312\302\303\300\301&\207\311\207" [substitute-in-file-name completion--sifn-requote "/ssh:detlef:/home/albinus//tm" "/ssh:detlef:/tm" 1 completion--twq-try 2 last 0 nil completion--twq-all] 11 "\n\n(fn UNQUOTED-RESULT OP)"](("/ssh:detlef:/tmp/" . 17) 1)
  completion--nth-completion(1 "/ssh:detlef:/home/albinus//tm" read-file-name-internal file-exists-p 29 (metadata (category . file) (completion--unquote-requote . t)))
  completion-try-completion("/ssh:detlef:/home/albinus//tm" read-file-name-internal file-exists-p 29 (metadata (category . file) (completion--unquote-requote . t)))
  completion--do-completion()
  minibuffer-complete()
  call-interactively(minibuffer-complete nil nil)
  read-from-minibuffer("Find file: " "/ssh:detlef:/home/albinus/" (keymap (keymap (32)) keymap (10 . minibuffer-complete-and-exit) (13 . minibuffer-complete-and-exit) keymap (menu-bar keymap (minibuf "Minibuf" keymap (tab menu-item "Complete" minibuffer-complete :help "Complete as far as possible") (space menu-item "Complete Word" minibuffer-complete-word :help "Complete at most one word") (63 menu-item "List Completions" minibuffer-completion-help :help "Display all possible completions") "Minibuf")) (27 keymap (118 . switch-to-completions)) (prior . switch-to-completions) (63 . minibuffer-completion-help) (32 . minibuffer-complete-word) (9 . minibuffer-complete) keymap (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the minibuffer") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuffer") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (10 . exit-minibuffer) (13 . exit-minibuffer) (7 . abort-recursive-edit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (up . previous-history-element) (prior . previous-history-element) (down . next-history-element) (next . next-history-element) (27 keymap (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))) nil file-name-history "/ssh:detlef:/home/albinus/" nil)
  completing-read-default("Find file: " read-file-name-internal file-exists-p confirm-after-completion "/ssh:detlef:/home/albinus/" file-name-history "/ssh:detlef:/home/albinus/" nil)
  completing-read("Find file: " read-file-name-internal file-exists-p confirm-after-completion "/ssh:detlef:/home/albinus/" file-name-history "/ssh:detlef:/home/albinus/")
  read-file-name-default("Find file: " nil "/ssh:detlef:/home/albinus/" confirm-after-completion nil nil)
  read-file-name("Find file: " nil "/ssh:detlef:/home/albinus/" confirm-after-completion)
  find-file-read-args("Find file: " confirm-after-completion)
  byte-code("\300\301\302 \"\207" [find-file-read-args "Find file: " confirm-nonexistent-file-or-buffer] 3)
  call-interactively(find-file nil nil)


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/home/albinus/src/emacs/etc/DEBUG.


In GNU Emacs 24.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2012-06-04 on detlef
Bzr revision: 108481 monnier <at> iro.umontreal.ca-20120604140833-gjtn2e5t63ivvks7
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Dired by name

Minor modes in effect:
  display-time-mode: t
  shell-dirtrack-mode: t
  iswitchb-mode: t
  icomplete-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 1 ; 1 4 0 0 ; 0 c C-x C-f / s u d o : : RET
ESC O F ESC [ A RET q ESC [ A RET q ESC [ A RET q ESC
[ A RET q C-x C-f / e t TAB C-g ESC x r e p o TAB r
TAB RET

Recent messages:

Tramp: Waiting for prompts from remote shell
Tramp: Sending Password
Tramp: Sending command `exec sudo -u root -s -H -p Password:'
Tramp: Found remote shell prompt on `detlef'
Tramp: Opening connection for root <at> detlef using sudo...done
Mark set
completion--twq-try: Assertion failed: (equal (funcall unquote qstring) completion)
Quit
Making completion list...

Load-path shadows:
~/src/tramp/lisp/tramp-smb hides /home/albinus/src/emacs/lisp/net/tramp-smb
~/src/tramp/lisp/tramp-uu hides /home/albinus/src/emacs/lisp/net/tramp-uu
~/src/tramp/lisp/tramp-cmds hides /home/albinus/src/emacs/lisp/net/tramp-cmds
~/src/tramp/lisp/tramp-cache hides /home/albinus/src/emacs/lisp/net/tramp-cache
~/src/tramp/lisp/trampver hides /home/albinus/src/emacs/lisp/net/trampver
~/src/tramp/lisp/tramp-ftp hides /home/albinus/src/emacs/lisp/net/tramp-ftp
~/src/tramp/lisp/tramp-sh hides /home/albinus/src/emacs/lisp/net/tramp-sh
~/src/tramp/lisp/tramp hides /home/albinus/src/emacs/lisp/net/tramp
~/lisp/dbus hides /home/albinus/src/emacs/lisp/net/dbus
~/lisp/soap-client hides /home/albinus/src/emacs/lisp/net/soap-client
~/src/tramp/lisp/tramp-gw hides /home/albinus/src/emacs/lisp/net/tramp-gw
~/src/tramp/lisp/tramp-gvfs hides /home/albinus/src/emacs/lisp/net/tramp-gvfs
~/src/tramp/lisp/tramp-compat hides /home/albinus/src/emacs/lisp/net/tramp-compat

Features:
(shadow sort mail-extr warnings emacsbug message rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils help-mode view
noutline outline easy-mmode tramp-cache tramp-sh debbugs-autoloads
package cperl-mode easymenu time tramp tramp-compat auth-source eieio
byte-opt bytecomp byte-compile cconv macroexp gnus-util mm-util
mail-prsvr password-cache shell pcomplete comint ansi-color ring
format-spec advice help-fns advice-preload tramp-loaddefs cl cl-lib
iswitchb jka-compr icomplete time-date paren ps-print ps-def lpr vc
ediff-merg ediff-diff ediff-wind ediff-help ediff-util ediff-mult
ediff-init ediff vc-dispatcher dired tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)



This bug report was last modified 13 years and 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.