Subject: Re: bug#13921: 24.2; Misbehavior of expand-file-name on Cygwin with Emacs 24.2

From: Eli Zaretskii <[email-masked]>
Date: Mon, 11 Mar 2013 19:43:53 +0200

> Date: Mon, 11 Mar 2013 13:21:38 -0400
> From: Barry OReilly <[email-masked]>
> Cc: [email-masked]
> 
> > By contrast, compilation of CEDET was probably run somewhere on drive
> > D:, so /home/epich/sw/cedet/lisp/cedet/loaddefs.el got D: prepended to
> > it.
> 
> No, it wasn't.  I type these two commands at the Cygwin shell without
> changing anything, including pwd:
> 
> emacs -batch --no-site-file --eval '(setq debug-on-error t)' -l
> "../../cedet-remove-builtin.el" -L . --eval '(progn (require (quote
> cedet-compat)) (require (quote mode-local)))' -L ../eieio/ -L ./ -L ./
> --eval '(progn  (setq generated-autoload-file
> "/home/epich/sw/cedet/lisp/cedet/loaddefs.el"))' -f batch-update-autoloads
> /home/epich/sw/cedet/lisp/cedet
> 
> emacs -batch --no-site-file --eval '(setq debug-on-error t)' -l
> "../../cedet-remove-builtin.el" -L . --eval '(progn (require (quote
> cedet-compat)) (require (quote mode-local)))' -L ../eieio/ -L ./ -L ./
> --eval '(progn  (setq generated-autoload-file
> "/home/epich/sw/cedet/lisp/cedet/loaddefs.el") (message "DEBUG: expanded
> file name is %s" (expand-file-name "/home/epich/sw/cedet/lisp/cedet")))'
> /home/epich/sw/cedet/lisp/cedet
> 
> The first yields an incorrect "d:" prefix, the second the "c:" prefix.  Why
> would this be?

I have no idea.  I don't have Cygwin installed, so I cannot try what
you did.  One way to try to figure that out would be for you to insert
'message' lines that display default-directory in a few places in the
code that gets run by this command, and see when it changes, and then
see why.

> This is evidence of an Emacs bug.

Sorry, but I need a more concrete evidence.  /foo/bar is not a
fully-qualified absolute name in the Windows build of Emacs, so we
need to establish where from does the drive letter come in this case,
before we can conclude whether or not it's an Emacs bug.  Taken at
face value, it is almost inconceivable that Emacs would somehow cough
up D: when the current drive is C:.

> > I don't know why you invoke Emacs from the Cygwin Bash.  I suggest not
> > to, or to switch to a Cygwin build of Emacs.  Mixing these two
> > environments is asking for trouble.
> 
> When I set up Cygwin, I did not install Cygwin's Emacs installation.  There
> is no conflict with an alternate Emacs.  I am merely using Cygwin's GNU
> Make to execute makefiles, which correctly invoke the Windows emacs.exe
> binary.  Why shouldn't that work?

Because Cygwin programs and native Windows programs are subtly
incompatible, in particular in their treatment of file names and drive
letters.  Cygwin can mount /home/foo to point to some arbitrary place
on any drive, whereas the native Windows build of Emacs does not grok
these mounts.