Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 927560

Summary: app-arch/rpm2targz: user and group in resulting tarball are the current user, rather than root
Product: Gentoo Linux Reporter: AI0867
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: minor    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch to set uid and gid to 0

Description AI0867 2024-03-22 23:22:49 UTC
Created attachment 888227 [details, diff]
Patch to set uid and gid to 0

rpm2targz unpacks the rpm into a temporary directory and then creates a tarball from that directory. That means the files are at that point owned by the user running the tool.

For my usecase (which I'm guessing is the most common one: deploying rpm-packaged software to a system that lacks a package manager), this means you have to make sure you run the command as root, pass --no-same-owner when extracting (not all tar implementations have that option) or chown the extracted files afterwards.

I've instead patched the script to pass --owner=0 and --group=0 to tar, so the files are owned by root.

Given that for all users besides root, file ownership is ignored when untarring, this does not seem like it will break any other usecases.

The package appears to be maintained in one of the gentoo repositories, but I have no idea how to make a pull request there, so I'm submitting the patch here.