doskey macros broken for inputs with >1 consecutive whitespace #20262

Open
opened 2026-01-31 07:08:26 +00:00 by claunia · 0 comments
Owner

Originally created by @lhecker on GitHub (Jul 20, 2023).

Originally assigned to: @lhecker on GitHub.

Steps to reproduce

Run this:

doskey foo=echo start $3 $2 $1 end
foo a b c
foo a  b c

Expected Behavior

start c b a end
start c b a end

Actual Behavior

start c b a end
start b  a end

The issue is caused by this function: 42e9ddcc78/src/host/alias.cpp (L833-L861)

For an input like "a b c" it'll return

"a"
""
"b"
"c"

The issue can either be fixed by fixing s_Tokenize itself or by reverting the code to the previous conhost v1 code. Either would likely be fine.

Originally created by @lhecker on GitHub (Jul 20, 2023). Originally assigned to: @lhecker on GitHub. ### Steps to reproduce Run this: ``` doskey foo=echo start $3 $2 $1 end foo a b c foo a b c ``` ### Expected Behavior ``` start c b a end start c b a end ``` ### Actual Behavior ``` start c b a end start b a end ``` The issue is caused by this function: https://github.com/microsoft/terminal/blob/42e9ddcc78710c101315a58b87c1c9db893fe3a7/src/host/alias.cpp#L833-L861 For an input like `"a b c"` it'll return ``` "a" "" "b" "c" ``` The issue can either be fixed by fixing `s_Tokenize` itself or by reverting the code to the previous conhost v1 code. Either would likely be fine.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20262