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

Creating tar archive fails with symbolic links #202

Closed
technicianted opened this issue Dec 2, 2019 · 1 comment
Closed

Creating tar archive fails with symbolic links #202

technicianted opened this issue Dec 2, 2019 · 1 comment

Comments

@technicianted
Copy link

What version of the package or command are you using?

3.3.0

What are you trying to do?

Create a new tar archive.

What steps did you take?

Create a tar archive from the following:

$ ls -l /tmp/testdata/
total 4
-rw-rw-r-- 1 1 Dec  2 09:22 file1
lrwxrwxrwx 1 9 Dec  2 09:22 linktofile1 -> /tmp/testdata/file1

With:

package main

import (
        "log"

        "github.com/mholt/archiver/v3"
)

func main() {
        t := archiver.NewTar()
       err := t.Archive(
                []string{
                        "/tmp/testdata/file1",
                        "/tmp/testdata/linktofile1",
                },
                "/tmp/archive.tar")
        if err != nil {
                log.Fatalf("failed to create archive: %v", err)
        }
}

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

A new archive is created at /tmp/archiver.tar but you get an error:

2019/12/02 09:23:35 failed to create archive: walking /tmp/testdata/linktofile1: /tmp/testdata/linktofile1: writing: linktofile1: readlink: readlink linktofile1: no such file or directory

How do you think this should be fixed?

When reading symbolic links using os.Readlink, a full filesystem path should be given rather than just the link name.

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

#201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants