Subject: 23.2; emacs-win32; emacswiki: cygwin-mount.el corrupted filename completion

From: Duane Ellis <[email-masked]>
Date: Sat, 04 Sep 2010 10:34:01 -0400

Hello,

I do not know where or how to report a problem with things on 
"emacswiki" - so I am trying here.
If someone knows a better place, please let me know.

-Duane

This problem is specific to:
 
(A)  emacs - windows prebuilt binary from ftp.gnu.org - (downloaded and 
found this bug yesterday)
     I can also duplicate with emacs-23.1

(B)  CYGWIN

(C) "cygwin-mount.el" found

    http://www.emacswiki.org/cgi-bin/wiki/download/cygwin-mount.el

(D) Filename(TAB) completion in the minibuffer using the above.

Short description:
   Filename 'tab-completion' with cygwin-mount.el corrupts completion

======
Steps to reproduce:

(1)  Emacs-23.2 (or 23.1) prebuilt windows binary from ftp.gnu.org

(2) Construct a simple directory structure as follows:
 
My hunch is this problem has to do with the 'depth' of filenames, or 
number of slashes present (see VARIANT below)

==========
bash-3.2$ ls -ldptr `find /home/duane/foo -print`
-rwxrwxrwx  1 duane None 6 Sep  4 09:37 /home/duane/foo/config.log
-rw-rw-rw-  1 duane None 6 Sep  4 09:37 /home/duane/foo/bar/config.log
-rwxrwxrwx  1 duane None 6 Sep  4 09:37 /home/duane/foo/config.status
-rw-rw-rw-  1 duane None 6 Sep  4 09:37 /home/duane/foo/bar/config.status
-rwxrwxrwx  1 duane None 6 Sep  4 09:37 /home/duane/foo/Makefile
-rw-rw-rw-  1 duane None 6 Sep  4 09:37 /home/duane/foo/bar/Makefile
drwxrwxrwx+ 2 duane None 0 Sep  4 09:37 /home/duane/foo/bar/bfd/
drwxrwxrwx+ 2 duane None 0 Sep  4 09:37 /home/duane/foo/bar/intl/
drwxrwxrwx+ 2 duane None 0 Sep  4 09:38 /home/duane/foo/bar/libiberty/
-rwxrwxrwx  1 duane None 4 Sep  4 09:38 /home/duane/foo/serdep.tmp
-rw-rw-rw-  1 duane None 4 Sep  4 09:38 /home/duane/foo/bar/serdep.tmp
-rwxrwxrwx  1 duane None 0 Sep  4 09:39 /home/duane/foo/build.log
-rw-rw-rw-  1 duane None 0 Sep  4 09:39 /home/duane/foo/bar/build.log
drwxrwxrwx+ 5 duane None 0 Sep  4 09:41 /home/duane/foo/bar/
drwxrwxrwx+ 2 duane None 0 Sep  4 09:43 /home/duane/foo/bfd/
drwxrwxrwx+ 2 duane None 0 Sep  4 09:43 /home/duane/foo/intl/
drwxrwxrwx+ 2 duane None 0 Sep  4 09:43 /home/duane/foo/libiberty/
drwxrwxrwx+ 6 duane None 0 Sep  4 09:43 /home/duane/foo/
bash-3.2$
=======

(3) Type 'ctrl-x, ctrl-x'  [aka: find-file]

(4) In the minibuffer - type/replace the text with:

    /home/duane/foo/bar/conf   (then STOP).

(5) Press <TAB> one time, this causes "filename-completion" to occur.

    The minibuffer shows (adding the "ig<period>"
        Find file: c:/cygwin/home/duane/foo/bar/config.
   AND: The prefix:  "c:/cygwin" becomes *GREY* in the minibuffer.

(6) Press <TAB> a second time, the minibuffer is now corrupt and shows:

    Find file: c:/cygwinc:/cygwin/home/duane/foo/bar/config.

   Note the two "c:/cygwin" prefixes - that is the bug I am reporting

    <TAB> completion no longer works as the candidate text is now corrupt.

(7) If I repeat the process, starting at "/home/duane/foo" - I do not 
have this problem.

=====

NOTE:

   I originally found this when building GDB/Insight from source, and 
reduced steps to the above sequence.

   This problem does not occur with (a) a very old (+5 years) version of 
'cygwin-mount.el' and (b) an older version of windows-emacs.

   I do not understand emacs lisp and/or the tab-completion code well 
enough to debug/fix this problem.

=====
VARIANTS - - in this form (and others like it), I cannot reproduce the 
problem

Step (a) start emacs {I click on a windows short cut to 'runemacs.exe')

Step (b) type ^X-^F, the mini buffer starts at:

        C:\emacs\bin/     -> NOTICE the two different slashes

Step (c) type  /home/duane/foo/bar/con  <STOP> do not press more keys

Mini buffer now shows:
   
    Find file: C:\emacs\bin//home/duane/foo/bar/con

NOTES:
    After typing the first "/"  (minibuffer shows:  "c:\emacs\bin//" - 
the original content is shown grayed out

Step (d) press TAB to attempt completion.

In this scenario, I cannot cause the problem to occur.

=====
DETAIL from "report-emacs-bug" in emacs
=====

In GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600)
 of 2010-05-08 on G41R2F1
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags 
-Ic:/xpm/include'

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: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <down-mouse-1> <mouse-1> C-x C-f C-a C-SPC
C-e C-w c / <backspace> : / h o m <C-backspace> <C-backspace>
/ h o m e / d u a n e / c y <backspace> <backspace>
i n s i <tab> <tab> s r <tab> c y <tab> <backspace>
o n <tab> <tab> C-g C-g C-x C-f ~ / * m e <tab> C-g
C-x b * m e <tab> <backspace> <backspace> <tab> M e
<tab> <return> C-x 1 <wheel-up> <down-mouse-1> <mouse-1>
<help-echo> <down-mouse-1> <mouse-1> M-x b u <backspace>
<backspace> r e p o r t - b <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...
Loading tramp...done
Quit [2 times]
Making completion list...
Quit
Making completion list...
byte-code: Beginning of buffer

Load-path shadows:
None found.

Features:
(shadow mail-extr message ecomplete rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp
ietf-drums mailabbrev nnheader mm-util mail-prsvr gmm-utils wid-edit
mailheader canlock sha1 hex-util hashcash mail-utils emacsbug tramp-imap
assoc tramp-gw tramp-fish tramp-cache tramp-ftp tramp-cmds tramp
auth-source gnus-util netrc time-date advice help-fns advice-preload
shell password-cache format-spec tramp-compat trampver help-mode
easymenu view sort cygwin-mount ange-ftp regexp-opt comint ring
executable cl cl-19 tooltip ediff-hook vc-hooks lisp-float-type mwheel
dos-w32 disp-table ls-lisp w32-win w32-vars tool-bar dnd fontset image
fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag 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 loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process multi-tty
emacs)