Payload file names lack the ./ prefix
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start by reading writePayload, which the issue identifies as the place to adjust payload names, and compare its behavior with the linked rpm archive writer in lib/rpmfi.cc. Reproduce the issue with the provided Go example and inspect the archive listing with rpm2cpio ... | cpio -t; done when payload paths have the ./ prefix and the listing matches rpmbuild's form.
Written by the indexing model from the issue text.
Description
rpm describes its payload convention in the rpmlib(PayloadFilesHavePrefix) feature: "package payload file(s) have "./" prefix." (lib/rpmds.cc), and rpm's own archive writer stores names as ./usr/bin/hello (lib/rpmfi.cc).
rpmpack writes the names exactly as given to AddFile, e.g. /usr/bin/hello. rpm -i accepts both forms, but tools that pass the payload through take the names as absolute: with rpm up to 4.19 (EL9, EL10), rpm2cpio pkg.rpm | cpio -idmv writes the files under / rather than the current directory, and rpmlint 1.11 (EL9), which unpacks payloads that way, reports no-binary for packages that contain binaries. (rpm2cpio from rpm 4.20 on rebuilds the archive and adds the prefix itself.)
Seen with v0.7.1 and current master.
Reproduce
package main
import (
"os"
"github.com/google/rpmpack"
)
func main() {
r, err := rpmpack.NewRPM(rpmpack.RPMMetaData{Name: "hello", Version: "1", Release: "1", Arch: "noarch"})
if err != nil {
panic(err)
}
r.AddFile(rpmpack.RPMFile{Name: "/usr/bin/hello", Body: []byte("#!/bin/sh\necho hello\n"), Mode: 0o100755})
f, err := os.Create("hello.rpm")
if err != nil {
panic(err)
}
defer f.Close()
if err := r.Write(f); err != nil {
panic(err)
}
}
On Oracle Linux 9 (rpm 4.16.1.3):
$ rpm2cpio hello.rpm | cpio -t
/usr/bin/hello
1 block
A package built by rpmbuild lists ./usr/bin/hello.
Suggested fix
Prefix payload names with . in writePayload, as rpm's archive writer does.
- Dominant language
- Go
- Stars
- 128
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/rpmpack
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Size of payload in header is incorrect - should be size of compressed payload, not uncompressedOpen
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Support RPM filetypesPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
Similar issues
-
Project submission:Open
Difficulty 1/5 Under an hour Newbie friendliness 72/100
slavakurilyak/awesome-ai-agents#845 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
JakeChampion/lang#13132 ·
Maintainers usually reply within 1 day
-
[BUG] deploy.restart_policy without condition drops the restart policyPossibly taken @akshat-lakhera claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
docker/compose#14383 · 1 comment ·
Maintainers usually reply within 1 day