Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

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

@claassen

Description

@claassen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions