Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Payload file names lack the ./ prefix

Open Beginner friendly
#109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
backend

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/rpmpack

All issues in google/rpmpack

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.