[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: substitute-in-file-name is not distributive

From: Daniel Colascione
Subject: Re: substitute-in-file-name is not distributive
Date: Tue, 30 Oct 2012 14:34:46 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 10/30/2012 2:24 PM, Stefan Monnier wrote:
>> Relative file names come up during builds. Say I'm editing foo.c and
>> the build system outputs "objchk\x86\foo.o" in some message: I want to
>> be able to append this relative path and get back a full Cygwin path.
> What do you append it to?  If the mapping is arbitrary, you first need
> to convert the Cywin name to Windows, the concat, then convert
> back, right?

Sure. In practice, concatenating short relative paths works pretty well, and I'd
like to translate /foo/bar/qux\bar/spam.txt to /foo/bar/qux/bar/spam.txt. That
work can be done inside the s-i-f-n handler.

>>> So Cygin itself treats "\\bin" and "/bin" as equivalent
>> No --- Cygwin treats "\\bin" just as Windows would: it's
>> a drive-letter-relative Windows path. "/bin" is a perfectly normal
>> POSIX path.
> Now I'm lost.  So you're saying that Cygwin accepts backslash delimited
> file names and assumes they're Window file names?  IOW Cygwin already
> accepts just as happily Windows file names?  In this case, I'm wondering
> why you need s-i-f-n.

Cygwin handles them, but Emacs doesn't. In the above example, as far as Emacs is
concerned, I'm editing a monolithic file with backslashes. For example,
find-file on "/etc\\passwd" successfully opens the passwd file (because Cygwin
does the translation internally), but the Emacs buffer name is "etc\\passwd" and
default-directory is "/".

> Is it because Cygwin needs backslashes to recognize Windows file names
> whereas Emacs wants to turn all backslashes into slashes?

I see Emacs treating backslashes as just another filename constituent.

> Side related question: this seems to be related to your cygw32, yet at
> the same tine it seems to be more GUI-independent.  How much of this
> affects Cygwin-X11 builds?  Why has it not been a problem until now?

You're right: the problem isn't GUI-specific. I just came across the problem
while doing general improvements to Cygwin Emacs. Maybe I'm the first one to be
really bothered by the problem. I do a lot of mixed Cygwin and Windows
development work.

>>> If you limit yourself to:
>>> - rewrite "\\`[a-zA-Z]:" to "/cygdrive/c" (regardless if it is followed
>> Not all Cygwin installations use "cygdrive".
> I kind of know.

Sorry for being repetitive.

>> Every instance of the word "cygdrive" in Emacs is a bug.
> Feel free to fix them.

After feature freeze.

>> "/cygdrive/c/bin/ls.exe" and "/bin/ls.exe" refer to the same file, but
>> because the paths differ, Emacs will consider these as two distinct
>> files.  Also, access semantics differ between drive-prefix-prefixed
>> paths and native Cygwin paths.
> That doesn't sound too terrible as a stop-gap until we can fix the
> underlying problem.

The aliasing issue breaks my workflow. If we can't fix the problem the right way
in 24.3, I'm happy leaving the situation the way it is, hacking around the
problem locally, and fixing it in 24.4.

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]