From cc5147134041ebe1b56379d0d14e573fc1ac536f Mon Sep 17 00:00:00 2001 From: TheGeogeo <57634077+TheGeogeo@users.noreply.github.com> Date: Tue, 24 Nov 2026 22:08:41 +0100 Subject: [PATCH 1/2] progress_dashboard: hide a whole drive path that contains spaces (DASH-SCRUB-SPACES) scrub() stopped at the first space, so the rest of a path outside the repository, file name included, stayed in the text. --- tests/test_progress_dashboard.py | 17 +++++++++++++++++ tools/progress_dashboard.py | 9 +++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/test_progress_dashboard.py b/tests/test_progress_dashboard.py index b5a15e80ce..bf0e61954f 100644 --- a/tests/test_progress_dashboard.py +++ b/tests/test_progress_dashboard.py @@ -517,6 +517,23 @@ def test_paths_outside_the_repository_lose_their_file_name(self): self.assertEqual(pd.scrub("in " + os.path.join(pd.HOME, "work", f"{SENTINEL}.fssm")), "in ") self.assertEqual(pd.scrub(f"C:{sep}work{sep}{SENTINEL}_a.fssm, C:{sep}{SENTINEL}_b.fssm"), " ") + def test_drive_paths_with_spaces_lose_their_whole_name(self): + for line, want in ( + (rf"FAIL: cannot read D:\My work\shaders\{SENTINEL}.fssm", "FAIL: cannot read "), + (rf"D:\My work\a b c\{SENTINEL}.fssm line 3", " line 3"), + (rf"D:\My work\{SENTINEL}_a.fssm, D:\Other work\{SENTINEL}_b.fssm", " "), + (f"FAIL: cannot read D:/My work/shaders/{SENTINEL}.fssm", "FAIL: cannot read "), + (rf"Permission denied: 'D:\\My work\\{SENTINEL} one.fssm'", "Permission denied: ''"), + (rf'File "D:\My work\{SENTINEL} one.py", line 3', 'File "", line 3'), + (r"D:\work\a.txt is not a folder", " is not a folder"), + (r"D:\work\a.txt, then tests/test_x.py failed", " then tests/test_x.py failed"), + ): + with self.subTest(line=line): + self.assertEqual(pd.scrub(line), want) + if os.name == "nt": + sibling = os.path.join(ROOT + " work", f"{SENTINEL} one.fssm") + self.assertEqual(pd.scrub(f"cannot read '{sibling}' now"), "cannot read '' now") + def test_paths_inside_the_repository_become_relative(self): line = "Error: " + os.path.join(ROOT, "tools", "text_tables.py") + " line 3" self.assertEqual(pd.scrub(line), "Error: tools/text_tables.py line 3") diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index 43d3fafdbb..c77fd81a3f 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py @@ -145,9 +145,14 @@ def shown(m): checkout = rf"(? 3: line = line.replace(HOME, "~") line = re.sub(r"~[\\/][^\s'\"]*", "", line) From db3f77d45db9ddecd69c07dfa53b9bae4260841d Mon Sep 17 00:00:00 2001 From: TheGeogeo <57634077+TheGeogeo@users.noreply.github.com> Date: Tue, 24 Nov 2026 22:48:14 +0100 Subject: [PATCH 2/2] progress_dashboard: let the other separator continue a drive path with spaces (DASH-SCRUB-SPACES) `D:/My work\name` and `D:\My work/name` were replaced only up to the space, so the file name stayed in the text. --- tests/test_progress_dashboard.py | 6 ++++++ tools/progress_dashboard.py | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test_progress_dashboard.py b/tests/test_progress_dashboard.py index bf0e61954f..3821209705 100644 --- a/tests/test_progress_dashboard.py +++ b/tests/test_progress_dashboard.py @@ -523,10 +523,16 @@ def test_drive_paths_with_spaces_lose_their_whole_name(self): (rf"D:\My work\a b c\{SENTINEL}.fssm line 3", " line 3"), (rf"D:\My work\{SENTINEL}_a.fssm, D:\Other work\{SENTINEL}_b.fssm", " "), (f"FAIL: cannot read D:/My work/shaders/{SENTINEL}.fssm", "FAIL: cannot read "), + (rf"cannot read D:/My work\fixtures\{SENTINEL}.txt", "cannot read "), + (rf"cannot read D:\My work/stubs/{SENTINEL}.spv", "cannot read "), + (rf"D:\My own work/sub dir\a b/{SENTINEL}.fssm line 3", " line 3"), + (rf"D:\My work/{SENTINEL}_a.fssm, D:/Other work\{SENTINEL}_b.fssm", " "), (rf"Permission denied: 'D:\\My work\\{SENTINEL} one.fssm'", "Permission denied: ''"), (rf'File "D:\My work\{SENTINEL} one.py", line 3', 'File "", line 3'), (r"D:\work\a.txt is not a folder", " is not a folder"), (r"D:\work\a.txt, then tests/test_x.py failed", " then tests/test_x.py failed"), + (r"D:\work\a.txt and tests/test_x.py failed", " and tests/test_x.py failed"), + (r"D:\work\a.txt is 3/4 done", " is 3/4 done"), ): with self.subTest(line=line): self.assertEqual(pd.scrub(line), want) diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index c77fd81a3f..9ef57f9c6a 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py @@ -146,11 +146,14 @@ def shown(m): # Consume a same-prefix sibling too, so shown() can redact its entire path. checkout_path = rf"{checkout}[^\s'\"]*" # A quoted drive path ends at its quote. An unquoted one goes on over spaces while a later part still has its - # separator, so `D:\My work\name` is one path and the prose after a path stays. + # separator, so `D:\My work\name` is one path and the prose after a path stays. The other separator continues it + # too (`D:/My work\name`), but only after a part with no dot or punctuation: the prose after a file has slashes. drive = r"\b[a-z]:" quoted_path = rf"(?i:(?<='){drive}[\\/][^']*(?=')|(?<=\"){drive}[\\/][^\"]*(?=\"))" more = r"(?:(?: +(?![a-z]:[\\/])[^\s'\"\\/]+)*? +(?![a-z]:[\\/])[^\s'\"\\/]+{sep}[^\s'\"]*)*" - drive_path = "(?i:" + "|".join(rf"{drive}{sep}[^\s'\"]*" + more.format(sep=sep) for sep in (r"\\", "/")) + ")" + folder = r"(?:[^\s'\"]*[\\/])?[^\s'\"\\/.,;:]*" + mixed = rf"(?:{folder}(?: +[^\s'\"\\/.,;:]+)*? +[^\s'\"\\/:]+[\\/])*" + drive_path = "(?i:" + "|".join(rf"{drive}{sep}{mixed}[^\s'\"]*" + more.format(sep=sep) for sep in (r"\\", "/")) + ")" posix_path = r"(? 3: