-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMD does not consistently respect PathExt #3487
Comments
Thanks for your rapid response! I already found #2003, but do not think this issue is a duplicate. It appears to me that #2003 is about calling files from bash (or some other WSL shell). But as far as I can tell, this issue has nothing to do with bash, as I did not even use it. Instead, this issue is about calling files located in certain directories, using a standard Windows tool. As far as I know, it may well be possible that somewhere, somehow, bash (or some other WSL shell) is implicitly called whenever CMD crawls WSL directories. This, however, seems to me unlikely, because
|
You're right I see what you are doing now.
Don't do that. For win32's purposes that directory does not exist.
CMD and PS do not implicitly call anything in WSL (
I'll re-categorize 'discussion' for good sport. But we're not in WSL actionable territory. You are going to find MSFT |
what wsl-alias does is creates a regarding the problem @MatthijsBlom discovered, the biggest confusion is caused by CMD acting differently when calling a batch file without an extension while navigated inside a wsl directory and while navigated in a regular directory (this has nothing to do with PATH) in the following screenshot, you can see that powershell doesn't have the same behavior as cmd. |
Update: i accidentally came across the root of this problem Take a look at this
this means there is some kind of a difference between the directories created through wsl (using the regular |
I wasn't able to reproduce that here on 18237. Might be cursed directory related #3356, given the default
...and
|
You're indeed right - after I turned off case sensitivity for that directory, I could run the same file by typing its name without extension in
Though it's still unclear why |
Possibly somewhere in the code cMd is being case sloppy but PowerShelL is not. Perhaps case-normalizing somewhere on the way with Experiment: Try doing everything all old-tymie and make the path all uppercase like it is the MSDOS days. Make the path |
I'm so glad I found this conversation. I've been tearing my hair out trying to figure out why I can't launch exe files without the .exe extension from cmd shells in directories that were created in WSL. This only started happening in 1803, previously this was not an issue. Sure enough, calling "fsutil.exe file setCaseSensitiveInfo . disable" fixes the problem! So the question is: is this a regression or an intentional change that improves something else? If so, what? |
UPDATE: I figured it out. First off, I read this post explaining the new case sensitivity features: https://blogs.msdn.microsoft.com/commandline/2018/02/28/per-directory-case-sensitivity-and-wsl/ A comment on that post got me thinking about how PATHEXT works. The extensions in PATHEXT are all uppercase (.COM, .EXE, .BAT; etc..). The reason PATHEXT works with lowercase ".exe" files is because of case insensitivity. Doing this fixed my problem without requiring me to disable case sensitivity on the directory: set PATHEXT=.exe;.bat;%PATHEXT% Whew. That is pretty subtle. One either needs to add both lower and uppecase versions of all desired extensions to PATHEXT, or disable default case sensitivity in WSL per that blog post. |
With WSL becoming increasingly popular, perhaps Microsoft should add lowercase versions of all the default extensions to the default PATHEXT. (And remove .JS while they're at it ... but that's another ball of wax.) |
Reasonable enough suggestion. That said, MSFT jettisoned the case sensitivity stuff as the default midway though this iteration. After the Fall Release rolls out we'll probably hear less and less about it. Majority of folks will come to think of it as "broken in Spring 2018 release fixed in Fall 2018 release" and that will be that. [This is all quite sad because anyone revisiting #101 will be told the solution is to turn on case sensitivity. Which is broken. So they turn it off. Which is a loop construct with no exit conditional.] |
Windows build number: Microsoft Windows [Version 10.0.17134.165]
Steps to reproduce
.BAT
and.PY
are both on my PATHEXT.%AppData%\local\bin
%LocalAppData%\Packages\CanonicalGr...\LocalState\rootfs\home\matthijs
hello.py
,hullo.bat
,hallo.py
, andhollo.bat
all contain a simple greeting and are distributed over the above two directories.CMD can find the files in the Windows directory just fine, but fails to find the files in the WSL directory if the extensions are omitted:
Remarkably, CMD's
where
has no trouble finding any of them:Hence the consistently in the title.
I did some comparing with PowerShell and the Run dialog.
PowerShell shows no difficulty:
The Run dialog seems to simply not mind PATHEXT: it fails only on
hello
andhallo
– the Python file names without extensions. Note that these failures are independent of file locations.Some notes & Conclusion
I first came across this issue at leongrdic/wsl-alias#3. Apparently the behavior of CMD has recently changed?
The above tests indicate that, at the very least, CMD's behavior is inconsistent with that of PowerShell and the Run dialog. It may be inconsistent with its past behavior as well. I also find it surprising, and a bit confusing.
I report this as
Many thanks for giving us the opportunity to even have this issue! 😄
The text was updated successfully, but these errors were encountered: