Subject: Re: bug#14030: 24.3; expand-file-name expands remote file name on Windows incorrectly

From: Michael Albinus <[email-masked]>
Date: Sun, 24 Mar 2013 18:21:48 +0100

Eli Zaretskii <[email-masked]> writes:

> My crystal ball says that your 24.3.50 snapshot was bootstrapped on
> MS-Windows, or at least Tramp was compiled on Windows.  See below.

In GNU Emacs 24.3.50.1 (i386-mingw-nt6.1.7600)
 of 2013-03-14 on VBOX
Bzr revision: 112044 [email-masked]
Windowing system distributor `Microsoft Corp.', version 6.1.7600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -IC:/emacs/libs/libXpm-3.5.10/include -IC:/emacs/libs/libXpm-3.5.10/src
 -IC:/emacs/libs/libpng-dev_1.4.3-1_win32/include
 -IC:/emacs/libs/zlib-dev_1.2.5-2_win32/include
 -IC:/emacs/libs/giflib-4.1.4-1-lib/include
 -IC:/emacs/libs/jpeg-6b-4-lib/include
 -IC:/emacs/libs/tiff-3.8.2-1-lib/include
 -IC:/emacs/libs/libxml2-2.7.8-w32-bin/include/libxml2
 -IC:/emacs/libs/gnutls-3.1.8-w32/include
 -IC:/emacs/libs/libiconv-1.14-2-mingw32-dev/include'

> So, somehow, compiling tramp-sh.el on Unix replaces the call to
> tramp-drop-volume-letter with nothing.  Perhaps the condition, viz.

Yes, that is intended. tramp-drop-volume-letter is not needed on GNU/Linux.

>   (defalias 'tramp-drop-volume-letter
>     (if (memq system-type '(cygwin windows-nt))  <<<<<<<<<<<<<<<<<<<
> 	(lambda (name)
> 	  "Cut off unnecessary drive letter from file NAME.
>   The functions `tramp-*-handle-expand-file-name' call `expand-file-name'
>   locally on a remote file name.  When the local system is a W32 system
>   but the remote system is Unix, this introduces a superfluous drive
>   letter into the file name.  This function removes it."
> 	  (save-match-data
> 	    (if (string-match "\\`[a-zA-Z]:/" name)
> 		(replace-match "/" nil t name)
> 	      name)))
>
>       'identity))
>
> is expanded at byte-compile time, instead of at run time?

Looks like this, yes.

> And I guess whatever has this effect was introduced between the
> release of 24.2 and 24.3 (which was the trunk until 24.2 release).

Yes, it was changed in bzr commit #105625.

Does this mean, this declaration requests Tramp to be compiled on MS
Windows?  I have used the official distribution from
<http://ftp.gnu.org/gnu/emacs/windows/>. It reports

In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7600)
 of 2013-03-17 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7600
Configured using:
 `configure --with-gcc (4.7) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'

We shall repackage Emacs 24.3 for MS Windows then. Other packages might
suffer from the same problem.

Best regards, Michael.