fix: use path.Join instead of filepath.Join for tar entry names#898
Merged
ericcurtin merged 2 commits intomainfrom May 1, 2026
Merged
fix: use path.Join instead of filepath.Join for tar entry names#898ericcurtin merged 2 commits intomainfrom
ericcurtin merged 2 commits intomainfrom
Conversation
On Windows, filepath.Join produces backslash-separated paths (e.g., blobs\sha256\hex). When the CLI packages a model into a tarball and sends it to the daemon, the reader splits entry names on '/' and skips entries with backslashes, causing 'missing blob' errors. Replace filepath.Join with path.Join in tarball Target so entry names always use forward slashes regardless of the OS. Fixes #894
Contributor
There was a problem hiding this comment.
Code Review
This pull request replaces the use of path/filepath with path for tar entry names to ensure consistent forward-slash separators across different operating systems, addressing a regression where backslashes were used on Windows. It also includes a new regression test and renames a parameter to avoid shadowing the path package. Feedback was provided to explicitly set the file mode to 0755 for directory entries in the tar archive to avoid permission issues during extraction.
Address review feedback: set an explicit file mode on directory entries so they are not created with zero permissions if the tar is ever extracted to disk.
ericcurtin
approved these changes
May 1, 2026
Contributor
ericcurtin
left a comment
There was a problem hiding this comment.
Looks great, thanks @ilopezluna
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
docker model package --from <model> --chat-template <file>fails with:Root Cause
tarball/target.gousedfilepath.Jointo build tar entry names. On Windows, this produces backslash-separated paths (e.g.,blobs\sha256\hex). When the daemon (Linux) reads the tarball, the reader splits entry names on/and skips entries with backslashes, so all blobs are silently ignored. The manifest then references blobs that were never stored → "missing blob".This only affects code paths that go through the tarball (i.e., when
canUseDaemonRepackageis false):--chat-template,--license,--mmproj,--gguf,--safetensors-dir,--dduf, etc. The simple--from --context-sizecase uses a direct daemon API and was never affected.Fix
Replace
filepath.Joinwithpath.Join(packagepath, notpath/filepath) intarball/target.go.path.Joinalways uses forward slashes regardless of the OS.Test
Added
TestTargetEntryNamesUseForwardSlasheswhich builds a model with GGUF + chat template, writes it to a tarball, and verifies no entry names contain backslashes.Fixes #894