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

fix: retain symlinks added to zip archives #3585

Merged
merged 1 commit into from Nov 30, 2022

Conversation

orirawlings
Copy link
Contributor

@orirawlings orirawlings commented Nov 22, 2022

fixes #3584

When following the reproduction steps in #3584 I now get the following contents for the zip archive:

$ goreleaser --snapshot --skip-publish
...
$ (mkdir thezip && cd thezip && unzip ../dist/test_0.0.0-SNAPSHOT-none_darwin_amd64.zip) && ls -lR thezip
Archive:  ../dist/test_0.0.0-SNAPSHOT-none_darwin_amd64.zip
  inflating: a/x                     -> ../x 
  inflating: a/x2                    -> x 
  inflating: x                       
  inflating: test                    
finishing deferred symbolic links:
  a/x                    -> ../x
  a/x2                   -> x
total 1640
drwxr-xr-x  4 orawlings  staff     128 Nov 22 16:19 a
-rwxr-xr-x  1 orawlings  staff  833104 Nov 22 16:19 test
-rw-r--r--  1 orawlings  staff       2 Nov 22 15:32 x

thezip/a:
total 0
lrwxr-xr-x  1 orawlings  staff  4 Nov 22 16:19 x -> ../x
lrwxr-xr-x  1 orawlings  staff  1 Nov 22 16:19 x2 -> x

I'm using goreleaser for a project that packages multiple binaries in zip archives. We also include symlinks within the zip archives to give some of the binaries an alternate (usually shorter) spelling so they are easier to invoke on the command line.

This brings the zip archive behavior regarding symlinks in line with tar.gz and tar archives.

@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 22, 2022
@codecov
Copy link

codecov bot commented Nov 24, 2022

Codecov Report

Merging #3585 (2813ab0) into main (f05f3b5) will decrease coverage by 0.04%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##             main    #3585      +/-   ##
==========================================
- Coverage   83.88%   83.83%   -0.05%     
==========================================
  Files         117      117              
  Lines        9790     9797       +7     
==========================================
+ Hits         8212     8213       +1     
- Misses       1271     1275       +4     
- Partials      307      309       +2     
Impacted Files Coverage Δ
pkg/archive/zip/zip.go 70.58% <50.00%> (-8.96%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@caarlos0 caarlos0 left a comment

Choose a reason for hiding this comment

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

just a couple of comments, but looking good so far, thank you!

pkg/archive/zip/zip_test.go Outdated Show resolved Hide resolved
pkg/archive/zip/zip.go Outdated Show resolved Hide resolved
@orirawlings
Copy link
Contributor Author

@caarlos0 Thank you for the review! I've updated this PR to address your feedback. Please let me know if there is anything else I should adjust.

@orirawlings orirawlings mentioned this pull request Nov 28, 2022
@caarlos0 caarlos0 merged commit 19ab124 into goreleaser:main Nov 30, 2022
@caarlos0
Copy link
Member

Thanks!

@github-actions github-actions bot added this to the v1.14.0 milestone Nov 30, 2022
@caarlos0 caarlos0 added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Nov 30, 2022
@orirawlings orirawlings deleted the zip-symlinks branch November 30, 2022 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

symlinks not retained in zip archives
2 participants