Repository navigation
archive: omit the ./ entry from release tarballs - #2491
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix tarballs by removing current directory entry
archive: omit the Oct 29, 2026
./ entry from release tarballs
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are blocking the Linux and macOS release-archive changes.
No open issues 🎉
What changed in this PR
Addresses #2476 by omitting the root ./ entry from Linux and macOS release tarballs, preventing extraction from applying its permissions and timestamp to the destination directory.
Changes:
- Archive named entries for both binaries and debug symbols instead of archiving
.. - Preserve hidden files and protect filenames beginning with
-from option parsing. - Expand filenames inside each source directory, with failure handling if changing directories fails.
| File | Description |
|---|---|
build/macos/archive.sh |
Updates both macOS archive commands and documents the globbing approach. |
build/linux/archive.sh |
Applies the same archive creation changes and explanation for Linux. |
Review effort: Balanced
The Linux and macOS archive scripts ran `tar -C <dir> .`, which records the current directory itself as a `./` entry at the top of the payload and symbols tarballs. The entry serves no purpose, and when a tarball is extracted with `tar -xf <tarball> -C <dir>`, as documented in the install guide, it makes tar apply the archived directory's mode and mtime to the destination directory. List the directory's entries by name instead. The glob has to expand inside the source directory, since tar applies -C itself rather than the shell, so cd in a subshell. Chain it with `&&` because errexit is ignored for a subshell on the left of `||`, and a failed cd must not archive the wrong directory. Pass `--` so a file name starting with `-` isn't treated as an option. The published binaries and symbols contain no hidden files, so the plain `*` glob archives everything that `.` did. Avoid shell-specific options such as bash's `shopt -s dotglob`, to stay shell agnostic. The set of archived files is unchanged apart from the removed entry. An empty source directory now fails to archive instead of producing a tarball containing only `./`. Assisted-by: GitHub Copilot Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
mjcheetham
force-pushed
the
copilot/fix-released-tarballs-entries
branch
from
October 29, 2026 11:30
909a34b to
3ce88f2
Compare
mjcheetham
marked this pull request as ready for review
October 29, 2026 11:31
mjcheetham
approved these changes
Oct 29, 2026
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.
The Linux and macOS release tarballs begin with a
./directory entry becausearchive.shrunstar -C <dir> .. The entry serves no purpose. When users extract with the documentedtar -xf <tarball> -C /usr/local/bin, it also makestarapply the archived directory's mode and mtime to the existing destination directory.build/linux/archive.sh,build/macos/archive.shThe payload and symbols
tarcalls (four in total) now list the directory's entries by name instead of.:Only the
./entry is removed. Every other archived file is the same as before.Why not
-C "$DIR" *:tarapplies-Citself, so the shell would expand*in the caller's working directory, not in$DIR. The glob has to expand inside$DIR, hence the subshell.&&chaining: bash ignoresset -efor a subshell on the left of||. Without&&, a failedcdwould fall through and archive the wrong directory.shopt -s dotglob:*skips hidden files by default, and the old.form included them.--: a file name starting with-is not parsed as ataroption.Behaviour change
An empty source directory now fails with "Failed to create binaries archive" (or "symbols"), because the glob matches nothing. Before, it produced a tarball containing only
./. For the payload this is arguably better. A real publish always puts.dbg,.pdbor.dSYMfiles in the symbols directory. Please flag it if you want an empty symbols directory skipped instead.Review notes
dotnet buildanddotnet testdo not run these scripts, because the distribution projects areBuild Project="false"ingit-credential-manager.slnx. The scripts are exercised bydotnet build build/linuxanddotnet build build/macos.lib-cli.shrejectsosx-*runtimes there. It differs from the Linux script only in help text and comments. Its exacttarlines were checked underbsdtar, which is libarchive-based like macOS'star.