Skip to content

feat: add support for hard links - #179

Merged
niemeyer merged 13 commits into
canonical:mainfrom
letFunny:hardlinks
Jan 10, 2025
Merged

niemeyer merged 13 commits into
canonical:mainfrom
letFunny:hardlinks

Conversation

@letFunny

@letFunny letFunny commented Dec 5, 2024

Copy link
Copy Markdown
Collaborator
  • 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

@niemeyer niemeyer left a comment

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.

Thanks, Alberto. This is looking great.

A few comments, and maybe the last pass:

Comment thread internal/deb/extract.go Resolved
Comment thread internal/deb/extract.go Resolved
Comment thread internal/deb/extract.go Resolved
Comment thread internal/deb/extract.go Resolved
Comment thread internal/fsutil/create.go Resolved
Comment thread internal/fsutil/create_test.go Resolved
Comment thread internal/manifest/report.go Resolved
Comment thread internal/manifest/report.go Resolved
Comment thread internal/testutil/pkgdata.go Resolved
Comment thread internal/deb/extract.go Outdated

// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@niemeyer niemeyer left a comment

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.

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

LGTM.

Comment thread internal/deb/extract.go Resolved
Comment thread internal/deb/extract.go Resolved
Comment thread internal/deb/extract.go Outdated
}
}
sort.Strings(errs)
return fmt.Errorf("%s", errs[0])

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.

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
Copy Markdown
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.

@niemeyer niemeyer left a comment

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.

Thanks!

@niemeyer
niemeyer merged commit 9d9d214 into canonical:main Jan 10, 2025
@letFunny
letFunny deleted the hardlinks branch January 21, 2025 17:13
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