unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell
@ 2016-11-22  9:12 Ulrich Windl
  2016-11-22  9:16 ` bug#24984: Acknowledgement (Emacs 25.1.1: Problems with file completion in Windows shell) Ulrich Windl
  2016-11-22 15:49 ` bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Ulrich Windl @ 2016-11-22  9:12 UTC (permalink / raw)
  To: 24984

I think this bug is new compared to Emacs 24.3:
Shell completion on MS-Windows does not work correctly. For excample:
---
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

c:\Windows\system32>cd /Users/Ulrich Windl/
cd /Users/Ulrich Windl/

c:\Users\Ulrich Windl>dir
dir
 Datenträger in Laufwerk C: ist Windows
 Volumeseriennummer: 42BC-2012

 Verzeichnis von c:\Users\Ulrich Windl

17.08.2016  14:10    <DIR>          .
17.08.2016  14:10    <DIR>          ..
04.08.2016  08:21    <DIR>          Application Data
15.03.2016  15:19    <DIR>          Contacts
17.08.2016  14:21    <DIR>          Desktop
18.10.2016  10:21    <DIR>          Documents
22.11.2016  09:49    <DIR>          Downloads
12.10.2016  10:13    <DIR>          Favorites
31.05.2016  12:16    <DIR>          Pictures
20.10.2016  08:23    <DIR>          Videos
               5 Datei(en),          4.542 Bytes
              20 Verzeichnis(se), 184.763.269.120 Bytes frei
---

When I try to complete "cd D", "Documents" is not in the list of possible
matches. Instead I see things that are NOT part of the current directory (but
of c:\Windows\system32), like this:
Possible completions are:
DRVSTORE/ 	Dism/ 	DriverStore/
da-DK/ 	de-DE/ 	de/
drivers/







^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24984: Acknowledgement (Emacs 25.1.1: Problems with file completion in Windows shell)
  2016-11-22  9:12 bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell Ulrich Windl
@ 2016-11-22  9:16 ` Ulrich Windl
  2016-11-22 15:49 ` bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Ulrich Windl @ 2016-11-22  9:16 UTC (permalink / raw)
  To: 24984

It seems Emacs does not change the directory internally, because when the shell buffer has prompt "c:\Users\Ulrich Windl\Documents\R>" and I use Cx C-f to open a file, the directory is "c:/Windows/System32". In all versions of Emacs I know the default directory is that of the buffer being visited, so my conclusion is that Emacs maintains the wrong directory for the buffer.







^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell
  2016-11-22  9:12 bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell Ulrich Windl
  2016-11-22  9:16 ` bug#24984: Acknowledgement (Emacs 25.1.1: Problems with file completion in Windows shell) Ulrich Windl
@ 2016-11-22 15:49 ` Eli Zaretskii
       [not found]   ` <58355F63020000A1000235CE@gwsmtp1.uni-regensburg.de>
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2016-11-22 15:49 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: 24984

> Date: Tue, 22 Nov 2016 10:12:16 +0100
> From: "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de>
> 
> I think this bug is new compared to Emacs 24.3:
> Shell completion on MS-Windows does not work correctly. For excample:
> ---
> Microsoft Windows [Version 6.1.7601]
> Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.
> 
> c:\Windows\system32>cd /Users/Ulrich Windl/
> cd /Users/Ulrich Windl/
> 
> c:\Users\Ulrich Windl>dir
> dir
>  Datenträger in Laufwerk C: ist Windows
>  Volumeseriennummer: 42BC-2012
> 
>  Verzeichnis von c:\Users\Ulrich Windl
> 
> 17.08.2016  14:10    <DIR>          .
> 17.08.2016  14:10    <DIR>          ..
> 04.08.2016  08:21    <DIR>          Application Data
> 15.03.2016  15:19    <DIR>          Contacts
> 17.08.2016  14:21    <DIR>          Desktop
> 18.10.2016  10:21    <DIR>          Documents
> 22.11.2016  09:49    <DIR>          Downloads
> 12.10.2016  10:13    <DIR>          Favorites
> 31.05.2016  12:16    <DIR>          Pictures
> 20.10.2016  08:23    <DIR>          Videos
>                5 Datei(en),          4.542 Bytes
>               20 Verzeichnis(se), 184.763.269.120 Bytes frei
> ---
> 
> When I try to complete "cd D", "Documents" is not in the list of possible
> matches. Instead I see things that are NOT part of the current directory (but
> of c:\Windows\system32), like this:
> Possible completions are:
> DRVSTORE/ 	Dism/ 	DriverStore/
> da-DK/ 	de-DE/ 	de/
> drivers/

I cannot reproduce this, after trying on 2 different machines, running
Windows 7 and XP.

However, the above example shows one potential user error which could
explain what you see: you don't enclose file names with embedded
spaces in quotes:

> c:\Windows\system32>cd /Users/Ulrich Windl/
> cd /Users/Ulrich Windl/

The first line should say

  c:\Windows\system32>cd "/Users/Ulrich Windl/"

or maybe even

  c:\Windows\system32>cd "\Users/Ulrich Windl\"

If you do that, does the problem go away?





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24984: Antw: Re: bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell
       [not found]   ` <58355F63020000A1000235CE@gwsmtp1.uni-regensburg.de>
@ 2016-11-24 17:29     ` Eli Zaretskii
  2016-11-24 21:05       ` bug#24984: Antw: " Ulrich Windl
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2016-11-24 17:29 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: 24984

[Please keep the bug address on the CC list.]

> Date: Wed, 23 Nov 2016 09:20:35 +0100
> From: "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de>
> 
> >>> Eli Zaretskii <eliz@gnu.org> schrieb am 22.11.2016 um 16:49 in Nachricht
> [...]
> > However, the above example shows one potential user error which could
> > explain what you see: you don't enclose file names with embedded
> > spaces in quotes:
> > 
> >> c:\Windows\system32>cd /Users/Ulrich Windl/
> >> cd /Users/Ulrich Windl/
> > 
> > The first line should say
> > 
> >   c:\Windows\system32>cd "/Users/Ulrich Windl/"
> > 
> > or maybe even
> > 
> >   c:\Windows\system32>cd "\Users/Ulrich Windl\"
> > 
> > If you do that, does the problem go away?
> 
> Yes, if I do that, the problem went away! However what I don't understand (still believing it worked before):
> c:\Windows\system32>cd /Users/Ulrich Windl/
> cd /Users/Ulrich Windl/
> 
> The output created by Emacs indicates it understood the argument, when it did not work, but when I do it correctly, the output is the same:
> c:\Users\Ulrich Windl\Documents\R>cd "/users/ulrich windl"
> cd "/users/ulrich windl"

Emacs is much smarter than cmd.exe.  More importantly, the directory
tracking in shell mode runs before the command is sent to the shell,
so it might not figure out that the shell failed.

In addition, cmd.exe was silently modified in Windows 7 so that it now
recognizes and accepts more dubious commands than before.  For
example, if you try the unquoted cd command, you will see it succeed,
whereas it shouldn't.  (It does fails on XP.)  I believe this is the
reason why you think it used to work in previous versions of Emacs.

So there's quite a hodge-podge of subtle issues and marginally
(in)correct behaviors here.

> And if I do completion in native Windows "cmd", it will place quotes around file names that contain a space. I think Emacs is internally smart enough to handle that case...

It deliberately doesn't try to.

Is it okay to close this bug report?

Thanks.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24984: Antw: Re: Antw: Re: bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell
  2016-11-24 17:29     ` bug#24984: Antw: " Eli Zaretskii
@ 2016-11-24 21:05       ` Ulrich Windl
  2016-11-25  7:14         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Ulrich Windl @ 2016-11-24 21:05 UTC (permalink / raw)
  To: eliz; +Cc: 24984



>>> Eli Zaretskii <eliz@gnu.org> 24.11.16 18.30 Uhr >>>
[Please keep the bug address on the CC list.]

[...]
Is it okay to close this bug report?

This nasty bug makes shell-mode practically unusable; why do you suggest to close the bug?

Thanks.






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24984: Antw: Re: Antw: Re: bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell
  2016-11-24 21:05       ` bug#24984: Antw: " Ulrich Windl
@ 2016-11-25  7:14         ` Eli Zaretskii
       [not found]           ` <5837FD3D020000A10002361A@gwsmtp1.uni-regensburg.de>
  2019-11-11  3:20           ` Stefan Kangas
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2016-11-25  7:14 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: 24984

> Date: Thu, 24 Nov 2016 22:05:54 +0100
> From: "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de>
> Cc: <24984@debbugs.gnu.org>
> 
> Is it okay to close this bug report?
> 
> This nasty bug makes shell-mode practically unusable; why do you suggest to close the bug?

Because it isn't a bug in Emacs, it's a user error: cmd.exe requires
such names to be quoted.  Am I missing something here?





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24984: Antw: Re: Antw: Re: bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell
       [not found]           ` <5837FD3D020000A10002361A@gwsmtp1.uni-regensburg.de>
@ 2016-11-25  8:58             ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2016-11-25  8:58 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: 24984

[Please keep the bug address on the CC list.]

> Date: Fri, 25 Nov 2016 08:58:37 +0100
> From: "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de>
> 
> >> This nasty bug makes shell-mode practically unusable; why do you suggest to 
> > close the bug?
> > 
> > Because it isn't a bug in Emacs, it's a user error: cmd.exe requires
> > such names to be quoted.  Am I missing something here?
> 
> Yes (reproduction):
> c:\Users\Ulrich Windl>cd ..
> cd ..
> 
> c:\Users>cd Ulrich Windl/     ### completed from Ul<TAB> (where <TAB> is the TAB key being pressed)
> cd Ulrich Windl/                     ### the command produced by Emacs is without quotes!
> 
> c:\Users\Ulrich Windl>cd Do    ### 1: The chdir seems to have succeeded (see prompt)
> ### "Do<TAB>" does not list any completions, because EMacs thinks the directory is different.
> c:\Users\Ulrich Windl>cd U<TAB> ### lets complete Emacs to "Ulrich Windl" again, because it thinks the directory is "C:\Users"
> ### When executing the "cd", it failes, od course:
> c:\Users\Ulrich Windl>cd Ulrich Windl/
> cd Ulrich Windl/
> Das System kann den angegebenen Pfad nicht finden.
> 
> ### So the shell does things correctly, but Emacs does not.

So you expect Emacs to quote such file names automatically?

Note that the Windows cmd.exe shell does it automatically only in some
cases.  For example:

  C:\>cd Docu TAB

produces

  C:\>cd "Documents and Settings"

as you'd expect, but

  C:\>cd Documents and Settings\My TAB

does not, it simply fails to complete.  Instead, you need to type
this:

  C:\>cd "Documents and Settings\My TAB

i.e. start the file name with a quote.

So there's no consistency in what the shell does here, either.

> Specifically if EMacs completes a name containing a space without putting quotes around, you cannot complein the shell for it (Compare to BASH: It does the quoting correctly is such a case)

What I see in "M-x shell" with Bash (on a GNU/Linux system) is not
entirely correct either:

  $ cd /home/e/eliz/foo TAB

produces

  $ cd /home/e/eliz/foo\ bar\ baz/

which is correct.  But

  $ cd '/home/e/eliz/foo TAB

produces this:

  $ cd '/home/e/eliz/foo\ bar\ baz/'
  bash: cd: /home/e/eliz/foo\ bar\ baz/: No such file or directory

If you try the same from the Bash command line, it does work
correctly: Bash completes "'foo " into "'foo bar baz'/", with the
closing quote and the slash added.

So my conclusion is that completion of such file names in "M-x shell"
does not work reliably on Posix hosts, either.

I'm okay with leaving this bug report open, with its subject retitled
"Completion of file names with embedded white space is broken in 'M-x
shell'", if you agree with my analysis.

Thanks.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24984: Antw: Re: Antw: Re: bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell
  2016-11-25  7:14         ` Eli Zaretskii
       [not found]           ` <5837FD3D020000A10002361A@gwsmtp1.uni-regensburg.de>
@ 2019-11-11  3:20           ` Stefan Kangas
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Kangas @ 2019-11-11  3:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Ulrich Windl, 24984

tags 24984 + notabug
close 24984
thanks

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Thu, 24 Nov 2016 22:05:54 +0100
>> From: "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de>
>> Cc: <24984@debbugs.gnu.org>
>> 
>> Is it okay to close this bug report?
>> 
>> This nasty bug makes shell-mode practically unusable; why do you suggest to close the bug?
>
> Because it isn't a bug in Emacs, it's a user error: cmd.exe requires
> such names to be quoted.  Am I missing something here?

More information was requested, but none was given within 3 years, so
I'm closing this bug.  If this is still an issue, please reopen the
bug report.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-11  3:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-22  9:12 bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell Ulrich Windl
2016-11-22  9:16 ` bug#24984: Acknowledgement (Emacs 25.1.1: Problems with file completion in Windows shell) Ulrich Windl
2016-11-22 15:49 ` bug#24984: Emacs 25.1.1: Problems with file completion in Windows shell Eli Zaretskii
     [not found]   ` <58355F63020000A1000235CE@gwsmtp1.uni-regensburg.de>
2016-11-24 17:29     ` bug#24984: Antw: " Eli Zaretskii
2016-11-24 21:05       ` bug#24984: Antw: " Ulrich Windl
2016-11-25  7:14         ` Eli Zaretskii
     [not found]           ` <5837FD3D020000A10002361A@gwsmtp1.uni-regensburg.de>
2016-11-25  8:58             ` Eli Zaretskii
2019-11-11  3:20           ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).