[PATCH v4 0/2] MR9040: cmd: Allow DIR /Oxxx at the command line to override DIRCMD=/Oyyy set in the environment.
Fix regression, likely caused by me, where DIR /O options entered at the command line do not override any /O options that might be set in the DIRCMD environment variable. Fix is to reset applicable sort order state whenever /O is encountered in the options list. -- v4: cmd: Allow DIR /Oxxx at the command line to override DIRCMD=/Oyyy set in the environment. cmd/tests: Test that DIR /Oxxx at the command line overrides DIRCMD=/Oyyy set in the environment. https://gitlab.winehq.org/wine/wine/-/merge_requests/9040
From: Joe Souza <jsouza(a)yahoo.com> --- programs/cmd/tests/test_builtins.cmd | 4 ++++ programs/cmd/tests/test_builtins.cmd.exp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index ff6acc8f945..7ac989593df 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -3079,6 +3079,10 @@ echo --- dir /B /O:G-NE echo --- dir /B /O:G-E-N +echo --- +set DIRCMD=/O:GN +dir /B /O:G-N +set DIRCMD= cd .. & rd /s/q foobar echo ------------ Testing attrib ------------ rem FIXME Add tests for archive, hidden and system attributes + mixed attributes modifications diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index f9bec6813d0..875a1f3f8e8 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1857,6 +1857,12 @@ a1.ab a1.ac a2.aa a1.aa +--- +(a)todo_wine@a2.ac +(a)todo_wine@a1.ab +(a)todo_wine@a2.aa +a1.ac +(a)todo_wine@a1.aa ------------ Testing attrib ------------ A(a)spaces@@drive@@path(a)foobar\foo(a)or_broken@A I(a)spaces@@drive@@path(a)foobar\foo A(a)spaces@@drive@@path(a)foobar\foo(a)or_broken@A I(a)spaces@@drive@@path(a)foobar\foo -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9040
From: Joe Souza <jsouza(a)yahoo.com> --- programs/cmd/directory.c | 8 +++++++- programs/cmd/tests/test_builtins.cmd.exp | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c index ac4ecfed2e6..96174a3f4fc 100644 --- a/programs/cmd/directory.c +++ b/programs/cmd/directory.c @@ -769,7 +769,13 @@ RETURN_CODE WCMD_directory(WCHAR *args) goto exit; } break; - case 'O': p = p + 1; + case 'O': /* Reset order state for each occurrence of /O, i.e. if DIRCMD contains /O and user + also specified /O on the command line. */ + dirOrder = Unspecified; + orderGroupDirs = FALSE; + orderReverse = FALSE; + orderGroupDirsReverse = FALSE; + p = p + 1; if (*p==':') p++; /* Skip optional : */ while (*p && *p != '/') { WINE_TRACE("Processing subparm '%c' (in %s)\n", *p, wine_dbgstr_w(quals)); diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 875a1f3f8e8..dde889755aa 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1858,11 +1858,11 @@ a1.ac a2.aa a1.aa --- -(a)todo_wine@a2.ac -(a)todo_wine@a1.ab -(a)todo_wine@a2.aa +a2.ac +a1.ab +a2.aa a1.ac -(a)todo_wine@a1.aa +a1.aa ------------ Testing attrib ------------ A(a)spaces@@drive@@path(a)foobar\foo(a)or_broken@A I(a)spaces@@drive@@path(a)foobar\foo A(a)spaces@@drive@@path(a)foobar\foo(a)or_broken@A I(a)spaces@@drive@@path(a)foobar\foo -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9040
This merge request was approved by eric pouech. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9040
participants (3)
-
eric pouech (@epo) -
Joe Souza -
Joe Souza (@JoeS209)