goreleaser / nfpm

nFPM is Not FPM - a simple deb, rpm, apk, ipk, and arch linux packager written in Go
https://nfpm.goreleaser.com/
MIT License
2.09k stars 154 forks source link

Relative paths for src are treated as symlinks #826

Closed leungster closed 3 weeks ago

leungster commented 1 month ago

What happened?

Given a config where src is a relative path to a file, nfpm forces the filetype to be a symlink. It appears the cause may be due to the usage of os.Readlink in files.go to check if the src is a symlink or not. os.Readlink does not convert the input into an absolute path first and will echo back relative paths as is per go docs.

I am using bazel to generate my src files and nfpm config file. Since bazel operates on relative paths, nfpm is forcing all my files to be symlinks in the output artifact.

How can we reproduce this?

Create a nfpm config with a relative path for src.

contents:
  - src: relative/path/foo
    dst: /usr/bin/foo

nfpm version

v2.34.0

Search

Code of Conduct

Additional context

No response

caarlos0 commented 3 weeks ago

I cannot reproduce this.

Tried writing a failing test, and it doesn't seem to happen, at least not on linux.

833

leungster commented 3 weeks ago

Thanks for looking into this.

I debugged this a bit more under Bazel and the file was actually a symlink. Bazel is creating symlinks under the execution path.