Repository navigation
scripts/meta_to_xml.ps1: a negative -Limit converts nothing and exits 0 (EGEN-META-TO-XML-LIMIT) - #6170
scripts/meta_to_xml.ps1: a negative -Limit converts nothing and exits 0 (EGEN-META-TO-XML-LIMIT)#6170evilclanker9000 wants to merge 3 commits into
Conversation
A negative value is true in PowerShell, so the loop guard \\ -and \ -ge \\ broke before the first blob: exit 0, 'pso ok 0 failed 0' and an empty failures.txt on a mistyped limit. ValidateRange(0, ...) rejects it at binding time; 0 still means every blob.
…imit bug) Runs the script against synthesized stand-ins for the three CodeWalker DLLs, so it needs no CodeWalker, no game files and no GPU. The fixture and the DLL stub builder move to module level for reuse; the existing path test keeps its fixture unchanged.
The default 0 must keep meaning 'no limit', so the new range cannot turn the documented default into a refusal.
|
Tested A separate performance observation for
AI-assisted. |
What
scripts/meta_to_xml.ps1took-Limitas a plain[int]. In PowerShell any non-zero value is true, so with a negative limit the loop guardif ($Limit -and $n -ge $Limit)is true at$n = 0and the run stops before the first blob. The script then printspso ok 0 failed 0; rbf ok 0 failed 0, writes an emptyfailures.txt, and exits 0: a mistyped limit looks exactly like a carve with no PSO/RBF metadata. (The sibling Python tools fix the same class of bug, e.g.tools/rpf9_carve.py'sbyte_countdocstring.)The parameter now carries
[ValidateRange(0, 2147483647)], so a negative value is refused while the arguments are bound, beforeAdd-Typetouches CodeWalker or<Out>is created.0keeps its documented meaning of "every blob"; the usage comment now says so.Test
python -I tests/test_meta_to_xml_paths.py -v— the new tests build the three CodeWalker DLLs as synthetic stand-ins with PowerShell's own compiler (existingBUILD_STUB), so nothing needs CodeWalker, game files or a GPU.Before the change (script from
upstream/main, tests from this PR):After the change:
With
-Limit -5the script now stops withCannot validate argument on parameter 'Limit'. The -5 argument is less than the minimum allowed range of 0.and exit status 1, and<Out>is not created.GPU
No GPU needed: neither the script's parameter binding nor the tests touch a driver.
Notes
0as "convert every blob" rather than making it invalid, because it is the parameter's default and the only way to say "no limit" today; the usage line now states it.ValidateRangeruns at binding time, which is why the refusal happens before the CodeWalker assemblies are loaded — that also made the behaviour testable without CodeWalker.AI-assisted.