Skip to content

d3d12_guid_sites: a missing image or an unwritable --json report is one ERROR line, not a traceback - #5735

Closed
evilclanker9000 wants to merge 1 commit into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/9-guidsites-paths
Closed

evilclanker9000 wants to merge 1 commit into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/9-guidsites-paths

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

tools/d3d12_guid_sites.py ended a whole run in a traceback on two file-I/O errors that are one line in the sibling tools/d3d12_iid_scan.py:

  • a missing, locked or folder input image: scan() raises OSError, but main() caught only (ValueError, struct.error), so the run died in FileNotFoundError inside scan() even when other images were listed;
  • --json naming a path in a folder that does not exist: the write was not guarded at all.

Both now print one ERROR: cannot read/write <path>: <reason> line and exit 2, the behaviour d3d12_iid_scan.py:168-170 and :186-188 already documents ("a missing, locked or folder image used to end the run in a traceback").

Test

tests/test_d3d12_guid_sites.py gains test_missing_image_is_one_error_line and test_json_in_a_missing_folder_is_one_error_line; both build their PE32+ fixtures by hand, no game files and no SDK needed. The same two tests are the ones that fail without the change:

python -I tests/test_d3d12_guid_sites.py
# before: Ran 9 tests ... FAILED (failures=2)
#   AssertionError: 1 != 2 : Traceback (most recent call last): ... FileNotFoundError ... no_such.dll
# after:  Ran 9 tests in 0.355s ... OK

CLI, before and after (missing image, exit code from subprocess):

before  exit 1 | FileNotFoundError: [Errno 2] No such file or directory: '...\no_such_input.rpf'
after   exit 2 | ERROR: cannot read ...\no_such_input.rpf: No such file or directory

python -m compileall -q tools tests passes.

No GPU needed.

Notes

  • Matched tools/d3d12_iid_scan.py instead of inventing a new message, so the two GUID tools report a bad path the same way.
  • The exit code is 2 and the report is not written when a listed image cannot be read, even if the earlier images scanned fine; that is what the sibling tool does, and a partial report from a partial input list is worse than none.
  • The image that is not a PE still keeps its older == <name>: skipped (...) line and exit 0, unchanged.

AI-assisted.

…ne ERROR line, not a traceback

The scan loop caught only ValueError/struct.error, so a missing, locked or folder image ended the whole run in a FileNotFoundError traceback, and the --json write did the same for a path in a missing folder. Both now print the one ERROR line and exit 2 that the sibling tools/d3d12_iid_scan.py prints.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 93eca2d (base 561b65a).

  • git diff --check clean.
  • python -I -m pytest tests/test_d3d12_guid_sites.py -q -> 9 passed.
  • Adds OSError -> one ERROR: cannot read ... line, exit 2 for images, and ERROR: cannot write ... for --json.

Verdict: close as duplicate. #5737 covers the same two hunks plus a missing --header, and both touch the same test-file insertion point and the same tool block, so they cannot merge cleanly together. Keep #5737.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate of #5737: same tool block and the same test insertion point, so both cannot land cleanly. #5737 adds the missing --header handling and leaves no-SDK machines unaffected (its default_header() only returns existing files).

Recommend closing this in favor of #5737.

@evilclanker9000

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #5737, which covers the same two hunks (missing image, unwritable --json) plus the missing --header handling on the same insertion point, so the two cannot land cleanly together. Keeping the fuller one.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants