Fix two diagnostic bugs in validate-modern.py#40418
Merged
Conversation
1. Line 394: f-string missing braces around info.size - was printing the
literal text '(info.size)' instead of the actual file size value.
Fix: Change (info.size) to ({info.size}).
2. Line 414: validate_config reassigned its 'path' parameter to the
resolved tar member path, then printed the (now-None) path in the
not-found error. Renamed the local to 'real_path' so the error
message references the original input path the caller asked for.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the tar-based distribution validator in distributions/validate-modern.py to improve diagnostic output during modern distribution validation. It targets two small validator bugs in the distributions tooling path used by the repository’s distribution-check workflow.
Changes:
- Fixes the oversized-file diagnostic so it prints the actual offending file size.
- Refactors
validate_config()to separate the requested config path from the resolved tar member path. - Adjusts config-file lookup and extraction to use the resolved tar path after symlink resolution.
The unexpected_keys error and 'Found valid keys' log were still using the resolved tar member path instead of the caller-supplied config path, so symlinked configs (e.g. /etc/wsl.conf -> /etc/wsl.conf.real) would still report the symlink target rather than the user-facing config name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
OneBlue
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix two bugs in
distributions/validate-modern.py.Bug 1: missing f-string interpolation
In
read_tar(), the size-too-big error printed the literal text(info.size)instead of the actual byte count:error(node, f'file: ""{path}"" is too big (info.size), max: {max_size}')Fixed to
({info.size})so the message reports the offending size.Bug 2: variable shadowing in
validate_config()The function took
path: stras input, then immediately did:_, path = get_tar_file(tar, path, follow_symlink=True)This overwrote the input parameter with the resolved tar path (which can be
Noneif the file isn't found). The subsequentif path is None: error(node, f'File ""{file}"" not found in tar')couldn't print the original requested path, and downstream messages ("Found unexpected_keys in...", "Found valid keys in...") logged the resolved-symlink path rather than the user-facing config name.Renamed the inner variable to
real_pathso the originalpathis preserved for diagnostics andreal_pathis used fortar.extractfile().Risk
Tooling-only script, no runtime impact. Improves diagnostic output of the distribution validator.