Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for hard links #179

Merged
merged 13 commits into from
Jan 10, 2025
Merged

Conversation

letFunny
Copy link
Collaborator

@letFunny letFunny commented Dec 5, 2024

  • Have you signed the CLA?

Hard links can now be extracted and they are correctly reflected in the manifest.

zhijie-yang and others added 2 commits December 5, 2024 11:23
Hard links can now be extracted and they are correctly reflected in the manifest.

---------

Co-authored-by: Rafid Bin Mostofa <[email protected]>
Co-authored-by: Alberto Carretero <[email protected]>
@cjdcordeiro cjdcordeiro requested a review from niemeyer December 5, 2024 10:50
@cjdcordeiro cjdcordeiro added the Priority Look at me first label Dec 5, 2024
Copy link
Contributor

@niemeyer niemeyer left a comment

Choose a reason for hiding this comment

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

Thanks, Alberto. This is looking great.

A few comments, and maybe the last pass:

internal/deb/extract.go Outdated Show resolved Hide resolved
internal/deb/extract.go Outdated Show resolved Hide resolved
internal/deb/extract.go Outdated Show resolved Hide resolved
internal/deb/extract.go Outdated Show resolved Hide resolved
internal/fsutil/create.go Outdated Show resolved Hide resolved
internal/fsutil/create_test.go Show resolved Hide resolved
internal/manifest/report.go Outdated Show resolved Hide resolved
internal/manifest/report.go Outdated Show resolved Hide resolved
internal/testutil/pkgdata.go Outdated Show resolved Hide resolved

// sanitizeTarPath removes the leading "./" from the source path in the tarball,
// and verifies that the path is not empty.
func sanitizeTarPath(path string) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have any logic that prevents the tar from leaving the target directory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, we don't at the moment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed offline to do it, just not in this PR.

Copy link
Contributor

@niemeyer niemeyer left a comment

Choose a reason for hiding this comment

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

Thanks! A few more trivials, mainly just follow ups of the previous points.

LGTM.

internal/deb/extract.go Show resolved Hide resolved
internal/deb/extract.go Outdated Show resolved Hide resolved
}
}
sort.Strings(errs)
return fmt.Errorf("%s", errs[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

Per comment in the prior review, we don't need to append all the errors to then return the first one. We can simply stop on the first thing we find and return the error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The problem with that is that the error won't be deterministic, right? Maybe we can sort the links instead of the error if that is more performant.

Copy link
Contributor

@niemeyer niemeyer left a comment

Choose a reason for hiding this comment

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

Thanks!

@niemeyer niemeyer merged commit 9d9d214 into canonical:main Jan 10, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority Look at me first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants