Navigation Menu

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

"no such file or directory" when reading symlinks #222

Closed
claassen opened this issue Jun 8, 2020 · 4 comments
Closed

"no such file or directory" when reading symlinks #222

claassen opened this issue Jun 8, 2020 · 4 comments

Comments

@claassen
Copy link

claassen commented Jun 8, 2020

What version of the package or command are you using?

github.com/mholt/archiver/v3 v3.3.0

What are you trying to do?

Create a zip from a folder that contains symlinks that is not directly in the current path

What steps did you take?

z.Archive([]string{"/Users/claasmi/.provisioning-cli/package"}, "package.zip")

What did you expect to happen, and what actually happened instead?

Expected: Successfully create the zip file
Actual: Fails with error:
walking /Users/claasmi/.provisioning-cli/package: /Users/claasmi/.provisioning-cli/package/node_modules/.bin/acorn: writing: package/node_modules/.bin/acorn: readlink: readlink package/node_modules/.bin/acorn: no such file or directory

How do you think this should be fixed?

I believe the issue is on this line:

archiver/zip.go

Line 341 in b44e6c6

linkTarget, err := os.Readlink(f.Name())

It tries to read the symlink file by just its base name, without resolving the full path

Please link to any related issues, pull requests, and/or discussion

None

Bonus: What do you use archiver for, and do you find it useful?

I use it for package app deployment packages for an internal CI/CD tool

@bh7cw
Copy link

bh7cw commented Oct 27, 2020

I met the same error when creating tar ball.

@nononsensecode
Copy link

Any updates to this issue ?

@iotanbo
Copy link
Contributor

iotanbo commented Oct 18, 2021

I've just got acquainted with this library, and I noticed that symlinks with target like ../SomeDir/SomeFile.txt (which is still within archive root directory) cause errors when creating not only in .zip, but also in .tar.gz archives.

iotanbo added a commit to iotanbo/archiver that referenced this issue Oct 18, 2021
iotanbo added a commit to iotanbo/archiver that referenced this issue Oct 19, 2021
iotanbo added a commit to iotanbo/archiver that referenced this issue Oct 19, 2021
iotanbo added a commit to iotanbo/archiver that referenced this issue Oct 19, 2021
iotanbo added a commit to iotanbo/archiver that referenced this issue Oct 19, 2021
@iotanbo
Copy link
Contributor

iotanbo commented Oct 19, 2021

I fixed this issue for myself as it was urgent, also submitted corresponding pull request.
If anyone wants to preview already fixed version:

go get github.com/iotanbo/archiver/v3@v3.5.1-iotanbo
import "github.com/iotanbo/archiver/v3"

iotanbo added a commit to iotanbo/archiver that referenced this issue Oct 28, 2021
@mholt mholt closed this as completed in e0c66cf Oct 28, 2021
iotanbo added a commit to iotanbo/archiver that referenced this issue Nov 27, 2021
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

No branches or pull requests

4 participants