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.
-- v3: cmd: Allow DIR /Oxxx at the command line to override DIRCMD=/Oyyy set in the environment. cmd/tests: Duplicate DIR /O tests, but specify parameters via DIRCMD environment variable.
From: Joe Souza jsouza@yahoo.com
--- programs/cmd/tests/test_builtins.cmd | 20 +++++++++++++ programs/cmd/tests/test_builtins.cmd.exp | 36 ++++++++++++++++++++++++ 2 files changed, 56 insertions(+)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index ff6acc8f945..6dfd42dfac0 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -3079,6 +3079,26 @@ echo --- dir /B /O:G-NE echo --- dir /B /O:G-E-N +rem Repeat tests but specify parameters in DIRCMD environment variable. +echo --- +set DIRCMD=/O: +dir /B +echo --- +set DIRCMD=/O:GN +dir /B +echo --- +set DIRCMD=/O:G-N +dir /B +echo --- +set DIRCMD=/O:GNE +dir /B +echo --- +set DIRCMD=/O:G-NE +dir /B +echo --- +set DIRCMD=/O:G-E-N +dir /B +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..c91b5733d2f 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1857,6 +1857,42 @@ a1.ab a1.ac a2.aa a1.aa +--- +a1.ab +a2.ac +a1.aa +a1.ac +a2.aa +--- +a1.ab +a2.ac +a1.aa +a1.ac +a2.aa +--- +a2.ac +a1.ab +a2.aa +a1.ac +a1.aa +--- +a1.ab +a2.ac +a1.aa +a1.ac +a2.aa +--- +a2.ac +a1.ab +a2.aa +a1.ac +a1.aa +--- +a2.ac +a1.ab +a1.ac +a2.aa +a1.aa ------------ Testing attrib ------------ A@spaces@@drive@@path@foobar\foo@or_broken@A I@spaces@@drive@@path@foobar\foo A@spaces@@drive@@path@foobar\foo@or_broken@A I@spaces@@drive@@path@foobar\foo
From: Joe Souza jsouza@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));
every single commit in the MR shall pass all the tests I don't see any todo_wine in the first commit, so either the tests don't cover the changes you're making, or you forgot to add the todo_wine to the first commit (and the passing ones shall be removed in the second commit)
On Fri Sep 26 08:54:11 2025 +0000, eric pouech wrote:
every single commit in the MR shall pass all the tests I don't see any todo_wine in the first commit, so either the tests don't cover the changes you're making, or you forgot to add the todo_wine to the first commit (and the passing ones shall be removed in the second commit)
I don't think you understand what the code change does. My first tests were better. You didn't like those, and wanted me to change them. The current tests will pass both before and after my changes. The problem wasn't that /O parameters specified in DIRCMD didn't work. The problem was that if /O was specified in DIRCMD then /O specified at the command line would not override the one specified in DIRCMD. I will change the tests once more so that they are correct, and I will add and remove the todo_wine bits as you require.