[Other] strata_bench redactor: the user-name substitution runs before the folder substitutions, so reports keep /home/<user>/Strata instead of <strata>
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 86/100
Direzione di ricerca
Leggi redactor() in tools/strata_bench.py e il test non riuscito RedactionTests.test_paths_names_ips_and_keys in tools/test_strata_bench.py. Esegui python -m unittest tools.test_strata_bench.RedactionTests.test_paths_names_ips_and_keys per confermare l’errore. Il lavoro è terminato quando il test ha esito positivo e i percorsi nella cartella home vengono oscurati come <strata>/….
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem: tools/strata_bench.py sorts its redactions by the length of the pattern, so a short user name
wins over the longer path that contains it. On a machine whose user name is short, the repository folder
is never replaced with <strata>: instead of <strata>/strata-x.json the report gets
/home/<user>/Strata/strata-x.json. The tool's own test for this fails on such machines.
Environment: Strata e88ee39d (0.2.0-beta), Ubuntu 26.04.1, Python 3.14.4. User name dgbox (5 chars),
home /home/dgbox, repository /home/dgbox/Strata, host name dgbox-ubuntu-server. No GPU involved.
Reproduce:
python -m unittest tools.test_strata_bench.RedactionTests.test_paths_names_ips_and_keys
Expected:
ok
Actual:
AssertionError: '<strata>' not found in 'loading /home/<user>/Strata/strata-x.json'
The same call directly:
red = strata_bench.redactor()
red("loading /home/dgbox/Strata/strata-x.json")
# 'loading /home/<user>/Strata/strata-x.json' (expected: 'loading <strata>/strata-x.json')
Why: in redactor() (tools/strata_bench.py, ~line 90) the substitutions are collected and then
subs.sort(key=lambda p: -len(p[0].pattern)) - ordered by the compiled pattern length, and the patterns
of user and host names are wrapped in (?<!\[\w-]) … (?![\w-]) (+20 characters). The name pattern is
therefore always longer than the folder pattern that contains that name (len(name)+20 against
len(name)+13 for /home/<name>/Strata), so <user> is substituted first and the <strata> and
<home> patterns have nothing left to match. The generic path_user regex then rewrites the path to
/home/<user>/….
Isolation of the condition: the same test passes when the repository is not under the home folder - in a
worktree at /tmp/gold-check (git worktree add /tmp/gold-check e88ee39d, same commit, same venv):
$ python -m unittest tools.test_strata_bench.RedactionTests.test_paths_names_ips_and_keys
.
Ran 1 test in 0.001s
OK
So the order is what matters, not the length of the user name: for any normal install (the repository
under the user's home) the folder substitutions are dead.
Reproduction status: reproduced locally in the working tree and in a clean worktree of e88ee39d; the
worktree at /tmp/gold-check is the control that isolates the condition. Consequence for published
reports: reports written by the tool on such an install keep /home/<user>/Strata/… where the format
expects <strata>/….
- Lingua principale
- C++
- Stelle
- 11.6k
- Fork
- 1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Niko1221/Strata
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Niko1221/Strata#3524 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
Niko1221/Strata#3512 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
Niko1221/Strata#3501 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di Niko1221/Strata
Issue simili
-
v9.6.0: CMake incorrectly enforces presence of libevdevForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
Rowan (2017) electron heating gives NaN for beta > beta_max; clip() then sets electrons to kel_minAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
parthenon-hpc-lab/kharma#213 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
metasequoiaime/msime#9113 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
tone-3000/tone3000-plugin#257 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Locked plugin flip-flops position on every refresh after being disabledForse già presa @Illustar0 l’ha presa oggi. Apertaissue report
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
ModOrganizer2/modorganizer#2449 ·