-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Cmder corrupts %PATH% if there is exclamation mark in it #1678
Comments
@daxgames still broken, make a directory called "!" and extract cmder into it, vendor/init.bat won't run properly |
I just wanted to ressurrect this bug, since I ran into it. Or should I open a new one ? |
|
It's maybe not a good idea, yet cmnder shouldn't mangle them. cmd.exe deals with them OK and can also use the %PATH%. A user may well be named "Hello!" and then you have it all over the place. |
! Expansion is configurable in clink. I think you can disable it completely which is what you are asking for. I just cant remember the exact setting. Cmder is trying to make cmd more like bash by providing this functuonlity as a default. The majority of people would not have directories with special characters in them as evidenced by the fact that this issue went stale and was closed automatically. We are reluctant to change long standing defaults without overwhelming request to do so. |
I don't know clink, so I can't comment on it. Only on bash. Interpreting '!' in environment variables strikes me as a bad idea irregardless. Again: bash certainly doesn't do it. e.g. |
OK @mulle-nat I did some looking at this. Sorry was in the car earlier responding via my phone. The reason this is failing is because Delayed expansion wraps env vars with Your directory has one
Again don't use special characters like |
I just read this https://ss64.com/nt/delayedexpansion.html and hey, what a crap feature that is. But anyway, I don't know that much about BAT files. I looked at
|
I am trying to help you by continuing to looking at this, not having much luck though. Cmd.exe is a crap shell that does a lot of bad stuff so these extensions were developed. The entire reason Cmder exists to try and make more usable. This is a very rare situation. If you can''t not have an |
My current workaround is, that I moved the corrupted PATH parts to the end of the definitions. But this will bite me in the future again I'm sure. I could probably just remove the code from I am running bash inside Cmder :). My setup is, that I run the Visual Studio command line shell, to get the environment variables. Then I start Cmder from within, to get a more sane terminal. And then inside Cmder I am starting WSL and then I am in a bash. But corrupting the PATH is still wrong IMO, so thats why am writing this. |
Using |
You say that it's wrong, but actually the list of characters, that are illegal for a directory name does not contain '!' https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file. It's not illegal on Unix either, just inconvenient. I will try your artifact and report. |
Looks good to me now. |
I noticed that when my user
PATH
environment variable contains some entry with!
, next entry gets corrupted thus executables there are not found then when running from Cmder while they are reachable from classic cmd.Don't know if that's Conemu or Cmder problem, but it seems that when parsing
PATH
, characters following!
till next semicolon (inclusive) get eaten, missing semicolon then causes that next entry is concatenated with preceding broken part and both ends up corrupted and executables are missing fromPATH
in Cmder.Similar, maybe related open issues #1589 , #1650
Example
user
PATH
in cmd (notice the entryc:\Users\501554096\!appdata;
and following entry withc:\Users\501554096\work\scriptsDeploy\;
):Path=C:\development\Ruby25-x64\bin;C:\ProgramData\Oracle\Java\javapath;C:\development\Python27\;C:\development\Python27\Scripts;C:\Oracle\product\11.2.0\client_2\bin;c:\Oracle\instantclient21\;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CA\DSM\bin;C:\Program Files (x86)\WinMerge;C:\Program Files (x86)\PuTTY\;C:\Program Files\PuTTY\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\GitExtensions\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\TortoiseGit\bin;c:\Users\501554096\!appdata\;c:\Users\501554096\work\scriptsDeploy\;c:\Program Files (x86)\PuTTY\;c:\development\gradle4\bin;c:\development\jarscan\;c:\development\ant\bin\;c:\development\maven\bin\;C:\Users\501554096\AppData\Local\atom\bin;c:\Users\501554096\apps\wget\
PATH
in cmder (!appdata;
gone, both entries combined intoc:\Users\501554096\\Users\501554096\work\scriptsDeploy\;
):Path=C:\Users\501554096\apps\cmder\bin;C:\Users\501554096\apps\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\Users\501554096\apps\cmder\vendor\conemu-maximus5;C:\Users\501554096\apps\cmder\vendor\conemu-maximus5\ConEmu;C:\development\Ruby25-x64\bin;C:\ProgramData\Oracle\Java\javapath;C:\development\Python27\;C:\development\Python27\Scripts;C:\Oracle\product\11.2.0\client_2\bin;c:\Oracle\instantclient21\;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CA\DSM\bin;C:\Program Files (x86)\WinMerge;C:\Program Files (x86)\PuTTY\;C:\Program Files\PuTTY\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\GitExtensions\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\TortoiseGit\bin;c:\Users\501554096\\Users\501554096\work\scriptsDeploy\;c:\Program Files (x86)\PuTTY\;c:\development\gradle4\bin;c:\development\jarscan\;c:\development\ant\bin\;c:\development\gource\;c:\development\maven\bin\;C:\Users\501554096\AppData\Local\atom\bin;c:\Users\501554096\apps\wget\;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\share\vim\vim74;C:\Users\501554096\apps\cmder\
Version
cmder: v1.3.5
os: Windows 7 x64
The text was updated successfully, but these errors were encountered: