Skip to content

tarAppender.addTarFile: normalize archivePath to POSIX - #40

Merged
vvoland merged 1 commit into
moby:mainfrom
thaJeztah:addTarFile_posix
Jul 15, 2026
Merged

tarAppender.addTarFile: normalize archivePath to POSIX#40
vvoland merged 1 commit into
moby:mainfrom
thaJeztah:addTarFile_posix

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

The archivePath is used as the path in the Tar archive, which uses POSIX / Unix paths.

Normalize the path as a defense in-depth (FileInfoHeader also normalizes), then use the normalized hdr.Name as source of truth to set Linkname.

The archivePath is used as the path in the Tar archive, which uses
POSIX / Unix paths.

Normalize the path as a defense in-depth (FileInfoHeader also normalizes),
then use the normalized hdr.Name as source of truth to set Linkname.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter

codecov-commenter commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.30%. Comparing base (2cd730e) to head (9e1498c).
⚠️ Report is 39 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
- Coverage   66.35%   65.30%   -1.05%     
==========================================
  Files          42       42              
  Lines        2027     2032       +5     
==========================================
- Hits         1345     1327      -18     
- Misses        497      532      +35     
+ Partials      185      173      -12     

☔ 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Normalizes archivePath to POSIX-style slashes before creating tar headers, ensuring paths stored inside the tar archive (and hardlink Linkname values) consistently use / regardless of host OS path separators.

Changes:

  • Normalize archivePath via filepath.ToSlash at the start of tarAppender.addTarFile.
  • Use hdr.Name (the canonicalized tar path) as the source of truth when recording hardlink targets in SeenFiles, so subsequent hardlink Linkname values are also canonical.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@thaJeztah
thaJeztah requested a review from vvoland July 15, 2026 12:59
@vvoland
vvoland merged commit 8ec3329 into moby:main Jul 15, 2026
12 checks passed
@thaJeztah
thaJeztah deleted the addTarFile_posix branch July 15, 2026 13:07
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.

4 participants