Skip to content

fix: missing path segments after untarring#514

Merged
kzantow merged 1 commit intoanchore:mainfrom
cwrau:fix/missing-path-segments
Feb 6, 2026
Merged

fix: missing path segments after untarring#514
kzantow merged 1 commit intoanchore:mainfrom
cwrau:fix/missing-path-segments

Conversation

@cwrau
Copy link
Copy Markdown
Contributor

@cwrau cwrau commented Feb 4, 2026

Fixes #492

Also adjusted the tarutil tests to use the real filesystem instead of MemMapFs,
as that just creates missing paths as opposed to erroring out, which is what the real filesystem does.


Also, you should think about either making the tests not dependent on docker, as not everyone has it installed, such as me.

Copy link
Copy Markdown
Contributor

@kzantow kzantow left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, I think the main change looks good. I left one comment about the test changes to simplify things.

In regards to eliminating Docker, I'm not sure how we could do that, since Docker is a first-class citizen in stereoscope and we need to test the functionality. We could maybe separate some of the tests to a docker integration suite, but we use docker quite a lot in our tools' testing to build test fixtures and such, if there were simple alternatives, I'd love to know!

It looks like your commits need to be Signed-Off

if tt.wantErr == nil {
tt.wantErr = require.NoError
}
root := t.TempDir()
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.

Instead of requiring passing the root dir everywhere, could you just use afero.NewBasePathFs(osFs, root)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, didn't know about this, thanks!

Changed 👌

@cwrau cwrau force-pushed the fix/missing-path-segments branch from 25c71e0 to b39f26a Compare February 5, 2026 08:46
chore: use the real filesystem for tests, as the MemMapFs is implemented differently

Signed-off-by: Chris Werner Rau <cwrau@cwrau.info>
@cwrau cwrau force-pushed the fix/missing-path-segments branch from b39f26a to 0d4686f Compare February 5, 2026 08:46
@kzantow kzantow merged commit f24caab into anchore:main Feb 6, 2026
7 checks passed
@kzantow
Copy link
Copy Markdown
Contributor

kzantow commented Feb 6, 2026

Thanks for the contribution @cwrau

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.

tar without all path segments fail to load

2 participants