Skip to content

fix(oci): skip digest-named directories during GC - #1526

Merged
TerryHowe merged 6 commits into
oras-project:mainfrom
wangyusheng1985:contribution-1525
Oct 14, 2026
Merged

TerryHowe merged 6 commits into
oras-project:mainfrom
wangyusheng1985:contribution-1525

Conversation

@wangyusheng1985

Copy link
Copy Markdown
Contributor

Fixes #1525.

Store.GC skipped directories under blobs/ but not under blobs/<alg>/. A directory whose name looks like a digest then reached os.Remove, which failed on a non-empty directory and aborted GC.

GC now skips those directories, and os.Remove errors include the path.

Signed-off-by: yusheng.wang <yusheng.wang@chaitin.com>
Comment thread content/oci/oci.go Resolved
Comment thread content/oci/oci.go Resolved
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

โœ… All modified and coverable lines are covered by tests.
โœ… Project coverage is 92.14%. Comparing base (32e0cbc) to head (6630054).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1526   +/-   ##
=======================================
  Coverage   92.14%   92.14%           
=======================================
  Files         103      103           
  Lines        8463     8465    +2     
=======================================
+ Hits         7798     7800    +2     
  Misses        654      654           
  Partials       11       11           

โ˜” View full report in Codecov by Harness.
๐Ÿ“ข Have feedback on the report? Share it here.

๐Ÿš€ New features to boost your workflow:
  • โ„๏ธ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See inline comments, thanks!

Comment thread content/oci/oci_test.go Resolved

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@TerryHowe
TerryHowe merged commit 356309e into oras-project:main Oct 14, 2026
12 checks passed
@TerryHowe TerryHowe mentioned this pull request Oct 14, 2026
TerryHowe pushed a commit that referenced this pull request Oct 15, 2026
Backport of #1526 to v2. Store.GC skipped directories under blobs/ but not under blobs/<alg>/, so a directory named like a digest reached os.Remove, which fails on a non-empty directory and aborts GC. GC now skips those directories, and os.Remove errors include the blob path.

Fixes #1579

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>
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.

fix(oci): GC aborts on a directory under blobs/<alg> named like a digest

2 participants