Skip to content

fix(package_cache): skip malformed variant json in get_variants - #2168

Open
Sanjays2402 wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
Sanjays2402:fix/pkg-cache-malformed-json
Open

fix(package_cache): skip malformed variant json in get_variants#2168
Sanjays2402 wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
Sanjays2402:fix/pkg-cache-malformed-json

Conversation

@Sanjays2402

Copy link
Copy Markdown

Closes #2016

A variant json file truncated by a full cache disk made json.loads raise straight out of PackageCache.get_variants(), so every rez-pkg-cache command that enumerates the cache crashed with a JSONDecodeError — including --clean, which is what you'd run to recover from exactly that situation.

Corrupt/unreadable variant json files are now skipped, matching how the pending-file loops in the same class already handle them. New test writes an empty variant json and asserts get_variants() returns cleanly; it fails with the reported JSONDecodeError without the fix.

A variant json file truncated or corrupted (eg by the cache disk filling
up) made json.loads raise out of PackageCache.get_variants, so every
rez-pkg-cache command that enumerates the cache - including --clean,
which is what you would run to recover - crashed with a JSONDecodeError.

Unreadable/corrupt variant json files are now skipped, matching how the
pending-file loops in the same class already handle them.

Closes AcademySoftwareFoundation#2016
@Sanjays2402
Sanjays2402 requested a review from a team as a code owner July 25, 2026 18:05
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

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.

rez-pkg-cache --clean fails when it encounters malformed json

1 participant