-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Can't bypass DOSkey macro with leading space #4189
Comments
The ' dir' does not work in my default console (CMD), it will still use the alias? |
Sorry, but are you a bot? If not, are you on the Experimental Console programming team trying to replicate my reported bug? The dir command is probably the most-used command in console operation, so how could you be without one? |
It's not counter-intuitive that matching a console alias would trim leading spaces. However, the doskey docs do state plainly that the user should "type the macro name starting at the first position on the command line". Moreover, they include the following instructions for creating a macro with same name as a command:
|
What I mean to say is that this bug report is claiming that running ' dir', after defining an alias for dir, should output the normal behavior of what is expected in CMD. But when I tested this outside WT, I did not see this behavior. The macro is always being run, and I do not have a way to run DIR with other options than the one given in the alias. I am running the same version of Windows, Microsoft Windows [Version 10.0.18363.535]. |
@Luuk34: ah, thanks for the clarification. But eryksun has found the chapter/verse of how it should work according to the docs - thanks! - and what it's doing is definitely NOT according to the docs. Can't speak to your situation/configuration. I've replicated it on two different machines. You do need to completely exit, then restart, your console session after unchecking/checking "use legacy console" to make the changes stick. Also:
Note that my original post says the way around it is to put a space before the "dir" command. That's the canonical method of bypassing a DOSkey macro with the same name as a nother command. |
It looks like this should be easy to fix. I can get it working in a local build just by deleting this line: Lines 1154 to 1155 in 9b92986
But I'm curious why that trimming routine was added in the first place if it's not compatible with the legacy console. Someone from the core team will probably need to confirm whether that was a mistake and it's safe to remove. |
Looks like our usability improvement was a usability detriment. 😄 |
Hi, it's been 2+ years and now I note this issue is still present in Windows 11! Looking at the status, I see it continues to be pushed out, and the last milestone Feb. 2 is past. Can we ensure this gets put in this time? The fix can't be that hard - don't left trim the command :-) |
@cniggeler this is currently slated for the current milestone, but is fairly low priority relative to some of the other bugs in the milestone. I do believe this is a fairly easy-starter issue if you'd like to try submitting a fix yourself 😉 |
Uh, OK I'll think about it. Windows being a for-profit product I'm surprised at the suggestion of a user-contributed, free solution ;-) |
@zadjii-msft I just found that you are in charge of this project - congrats! That being the case, what is your strategy for handling bugs? This IS a functional bug - I'm not asking about font rendering or cursor blink rate. When does the fact that this is a bug, that it's been aging two years, and that it's probably a one-line change (since you or your team would know where the line is and I don't) factor into your decision to just fix this and close it? |
Huh, this is pretty curious. Would you be able to run it under the debugger after enabling loader snaps?
When you run OpenConsole under the debugger, it should emit a terrible volume of text about library loading, symbol binding, etc. that might help figure out why it won't load on this machine. 😄 |
Hmm. Quite possible... but to my knowledge we haven't made any changes that would exclude running on that version. In addition, I think @cniggeler was only stating that they have that SDK installed (not that they're running on that version of Windows!) |
I'm running Windows 10 Pro 21H1. Microsoft Windows [Version 10.0.19044.1586]. @DHowett is correct that that was the version for the SDK. I will run openconsole through windbg with loader snaps and reply next. |
@DHowett I loaded gflags and checked loader snaps as requested. I pressed Launch, which had no visual feedback, so I returned to Windbg. There is now 2155 lines of info, which I've attached as a text file. I have VS2017 loaded on the test machine. Would it be possible/ advisable to build with debug info on the VS2019 build machine and then open the debug .exe in VS2017 on the test machine? |
It looks like everything we need is loading; any libraries that can't be found (Status Can you generate a backtrace when you get here? I wonder if we're exiting in an orderly fashion for some reason... A debug build might help. You'll have to copy over the debug CRT (from the |
I'm assuming you meant View - Call stack: Also, here's the output after selecting GO, which adds another 1050 lines of output: |
Indeed! It looks like the console is choosing to exit at |
I think this took. I kept getting message WARNING: Non-directory path: 'C:\temp\OpenConsole.pdb' even after using "Browse" in windbg. Anyway, slightly larger file attached: |
And what's the call stack at termination for that build? :) |
Update: I also tried this on a brand new Win11 machine. Installed the latest C runtime and copied the release version of OpenConsole.exe to it. It also does not run. |
You know, I'm still stumped by this. Sorry to leave you on read. Here's what I'll say: You can send out a pull request if you'd like, without further validation. The CI will take care of producing a runnable copy of this kit and kaboodle and then actually run it on your behalf 😄 To be fair, trying to validate something on multiple machines is farther than I suspect most of the team usually goes 😁 |
Thanks. At this stage I was more interested in why the build wasn't able to run on different machines, because maybe that would point out some corrective action in the build scripts or execution prerequisites. But I would love to have it on my main machine where I work every day - been waiting 2.25 years for it! The change was literally the one line change above, and a pull request seems heavyweight. Is there an alternative to just add it to the branch for the next scheduled release? My build/test has managed to show it works ;-) |
## Summary of the Pull Request When you create a console alias that overrides an existing command, it should still be possible to execute the original command by prefixing it with a space. However, at some point in the past, there was an attempt to improve the usability by trimming leading spaces, and that ended up breaking this functionality. This PR reverts that change, so leading spaces can once again be used to bypass an alias. ## PR Checklist * [x] Closes #4189 * [x] CLA signed. * [x] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [x] I've discussed this with core contributors already. Issue number where discussion took place: #4189 ## Validation Steps Performed I've updated the existing alias unit test for leading spaces to match the new behavior, i.e. it now confirms that a command with leading spaces will not match the alias. I've also manually confirmed that the `doskey` test case reported in issue #4189 is now working as expected.
## Summary of the Pull Request When you create a console alias that overrides an existing command, it should still be possible to execute the original command by prefixing it with a space. However, at some point in the past, there was an attempt to improve the usability by trimming leading spaces, and that ended up breaking this functionality. This PR reverts that change, so leading spaces can once again be used to bypass an alias. ## PR Checklist * [x] Closes #4189 * [x] CLA signed. * [x] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [x] I've discussed this with core contributors already. Issue number where discussion took place: #4189 ## Validation Steps Performed I've updated the existing alias unit test for leading spaces to match the new behavior, i.e. it now confirms that a command with leading spaces will not match the alias. I've also manually confirmed that the `doskey` test case reported in issue #4189 is now working as expected. (cherry picked from commit cd2166a) Service-Card-Id: 84072860 Service-Version: 1.15
🎉This issue was addressed in #13476, which has now been successfully released as Handy links: |
I'm trying v1.15.200 and am encountering problems for which I've entered a separate comment under its release. My questions here are,
Thanks! |
The Windows Terminal is a modern, fast, efficient, powerful, and productive terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL. Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and custom themes, styles, and configurations. In other words Terminal is an app which combines the functionality of different shells.
see: Legacy Console Mode
?
|
Thanks for the reply! Some of this raises more questions than it answers.
This link references "the Console Host team". Who is that? In Task Manager, the "Windows Command Processor" app is comprised of two components: Console Windows Host (conhost.exe) and (the recursively named) Windows Command Processor (cmd.exe). But if I try to run conhost.exe by itself, nothing happens (Run... type in conhost, no window opens). Then, in the next paragraph, that linked page says "If you experience an issue that requires you to use the legacy console that is not documented here, please contact the team on the microsoft/terminal GitHub repository." This is how/why I opened this ticket regarding doskey. Is the Terminal team different from the Console Host team? This is still unclear: if I UNcheck "Use legacy console" in the conhost console that comes up when I run cmd.exe, what application is then run - is it Terminal? Because if it is, I can say for sure that the Terminal Preview v1.15.200 is NOT being accessed. Or is it instead some extended mode of conhost.exe? All of which lead me to ask my last question, which I will try to rephrase in a couple questions:
Thanks! |
@Sniggler: too much questions for /me to answer (and not make any mistakes, or wrong assumptions), I will leave that to the Team which is responsible for this 😉 |
Despite the merge and closed-fixed claim in #13476 afraid this is still not fixed in 1.19.10573.0! The test process is the same as it's always been. |
Environment
Steps to reproduce
Create a DOSkey macro, e.g.,
doskey dir=dir /b
Run the command,
dir
then run the command (note space in front)
dir
Expected behavior
In the 2nd run, you should get the default "dir" listing. This is the case in classic console.
Actual behavior
You get the results of "dir /b" again!
The text was updated successfully, but these errors were encountered: