On Wed Nov 22 18:02:56 2023 +0000, eric pouech wrote:
my point is more about the way to implement the fix rather if the propose fix passes the tests cmd as of today is barely maintanable because of small adjustements here and there, added over the years your proposal is such a small adjustment by changing behavior of some helper functions, depending on context, whereas IMO the cause of the issue lies elsewhere
I can appreciate the fact that Wine's cmd.exe implementation is kind of ugly. Nonetheless, in my opinion it's not reasonable to require a near-total rewrite of cmd.exe in order to fix this bug. `IF` is very special in cmd, and would still have to be treated specially even if cmd.exe were completely rewritten. The correct order of operations is to expand % variables, then parse the operands, then expand ! variables. Whether we have functions like handleExpansion, evaluate_if_condition, and do_delayed_expansion for those steps or whether we have a tokenizer that does it all, there has to be code to define the order, and that code would be similar in either case.