[PATCH v2 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. -- v2: cmd/tests: Add DIR test for /o set in DIRCMD environment variable. https://gitlab.winehq.org/wine/wine/-/merge_requests/9040
From: Joe Souza <jsouza(a)yahoo.com> --- programs/cmd/directory.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)); -- GitLab 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..933885790dd 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -3068,6 +3068,9 @@ echo A>a1.ac echo AA>a2.aa mkdir a2.ac echo --- +set DIRCMD=/o +dir /B +echo --- dir /B /O: echo --- dir /B /O:GN @@ -3080,6 +3083,7 @@ dir /B /O:G-NE echo --- dir /B /O:G-E-N cd .. & rd /s/q foobar +set DIRCMD= echo ------------ Testing attrib ------------ rem FIXME Add tests for archive, hidden and system attributes + mixed attributes modifications mkdir foobar & cd foobar diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index f9bec6813d0..b7cc2abba7b 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1834,6 +1834,12 @@ a1.aa a1.ac a2.aa --- +a1.ab +a2.ac +a1.aa +a1.ac +a2.aa +--- a2.ac a1.ab a2.aa -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9040
On Wed Sep 24 21:49:14 2025 +0000, eric pouech wrote:
it would be better to add also tests for DIRCMD (restricted to /O case) Done.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9040#note_116833
- tests should be first commit so that one can see what the second patch changes - setting DIRCMD changes what the existing tests are doing; so it should be better to clone the tests that make sense to run with DIRCMD set -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9040#note_116842
On Thu Sep 25 08:28:21 2025 +0000, eric pouech wrote:
- tests should be first commit so that one can see what the second patch changes - setting DIRCMD changes what the existing tests are doing; so it should be better to clone the tests that make sense to run with DIRCMD set Setting DIRCMD does not change the output of the preexisting tests, as the /O parameters on the command line override the /O parameter in DIRCMD. The test was intended to ensure that the override occurred. But as you wish, I will change the tests, probably later today or tomorrow.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9040#note_116843
On Thu Sep 25 08:28:21 2025 +0000, Joe Souza wrote:
Setting DIRCMD does not change the output of the preexisting tests, as the /O parameters on the command line override the /O parameter in DIRCMD. The test was intended to ensure that the override occurred. But as you wish, I will change the tests, probably later today or tomorrow. Also, the test was the second commit because without the code change first, the test would fail because the override did not occur.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9040#note_116844
participants (3)
-
eric pouech (@epo) -
Joe Souza -
Joe Souza (@JoeS209)