Subject: Re: bug#18628: Emacs hangs trying to open "CON" file (on Windows)

From: Lee Houghton <[email-masked]>
Date: Sun, 5 Oct 2014 12:33:36 +0100

On 4 October 2014 17:51, Eli Zaretskii <[email-masked]> wrote:
>> From: Lee Houghton <[email-masked]>
>> Date: Sat, 4 Oct 2014 16:20:38 +0100
>>
>> I don't know if this can really be counted as a bug, as CON is the
>> windows equivalent of /dev/stdin, (and of course I deserve it for
>> using Windows), but it is a frustrating problem, especially when I am
>> using helm-mode and trying to get my "config" directory and it decides
>> to read the "CON" file instead.
>
> Please provide a reproducible recipe starting with "emacs -Q".  Just
> typing "C-x C-f con TAB TAB" doesn't show CON in the completions, so
> I'm unsure how you bump into this problem.

Sorry, I didn't know that was required. The easiest way I found was:

emacs -Q con.js

Or if you want to go the long way...

emacs -Q --eval "(find-file \"CON.js\")"

(I hope I've understood what you mean by that.)

In this case, if I run it from the console, I can press Ctrl-C in the
console and then emacs un-hangs. But I imagine most people who run
emacs on Windows do so using runemacs and don't have a separate
console window in which to press Ctrl-C.

>> To reproduce the problem:
>>
>> Open the scratch buffer, execute (find-file "CON") and watch emacs hang.
>
> Well, then don't do that, right?  There cannot be a usable file by
> that name on Windows, so why would you need to try visiting it?

It is partly helm's fault. The reason I encounter this bug so often is
that I have a directory which contains two subdirectories,
"collections" and "config".  The quickest way for me to navigate to
the config directory would be C-x C-f c o n <right> (where C-x C-f is
bound to helm-find-file). Normally the <right> key would auto-complete
to the config directory. Instead what it does is try to preview the
"CON" file in the window I was just in, and emacs hangs. Sometimes I
remember to type "conf" before pressing <right>, sometimes I don't.
When I don't, I invariably kick myself :-)

The reason I chose this mailing list instead of the developers of
helm-mode is that
 a) Not many people know about the special behaviour of "CON" -- that
is, even if you add a file extension it still has the same behaviour
-- and could conceivably try to create a file called "con.c" or
similar, even if not using helm,
 b) No other text editor that I can find hangs when trying to create a
file named "con" or "con.c".

By all means close this bug if you think it's invalid! I am sure I
could find a workaround.