Cannot build SPEC file as non-root user
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mach (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
After setting up my user in the mach group
uid=1001(abovill) gid=130(mach) groups=
I tried to build a package from a spec file.
mach build pkg/myprog.spec
...
DEBUG: locking root
DEBUG: Build options to rpmbuild: []
Building .src.rpm from myprog.spec
DEBUG: build: quoted options_string:
DEBUG: Spec.__init__: opening spec pkg/myprog.spec
DEBUG: Executing /usr/lib/
DEBUG: copying 'pkg/myprog.spec' to '/var/lib/
DEBUG: Spec:__init__: command: rpmbuild -bp --nodeps --force --define '__spec_prep_pre exit 0' --define 'setup :' /tmp/myprog.spec
DEBUG: Executing /usr/lib/
DEBUG: Spec:__init__: command: rpmbuild -bp --nodeps --force --define '__spec_prep_pre echo %name; exit 0' --define 'setup :' /tmp/myprog.spec
DEBUG: Executing /usr/lib/
DEBUG: result for name: myprog
DEBUG: Spec:__init__: command: rpmbuild -bp --nodeps --force --define '__spec_prep_pre echo %version; exit 0' --define 'setup :' /tmp/myprog.spec
DEBUG: Executing /usr/lib/
DEBUG: result for version: 0.0.1
DEBUG: Spec:__init__: command: rpmbuild -bp --nodeps --force --define '__spec_prep_pre echo %release; exit 0' --define 'setup :' /tmp/myprog.spec
DEBUG: Executing /usr/lib/
DEBUG: result for release: 1
DEBUG: scanning spec file for %define's
DEBUG: Spec:__init__: command: rpmbuild -bp --nodeps --force --define '__spec_prep_pre echo %SOURCEURL0; exit 0' --define 'setup :' /tmp/myprog.spec
DEBUG: Executing /usr/lib/
DEBUG: result for Source: myprog-0.0.1.tar.gz
DEBUG: ensuring dir /var/tmp/
DEBUG: build: files to download: ['myprog-
DEBUG: build: paths to check: ['/var/
Using ./myprog-
DEBUG: Getting file ./myprog-
DEBUG: copying './myprog-
DEBUG: Executing /usr/lib/
DEBUG: Executing /usr/lib/
DEBUG: copying 'pkg/myprog.spec' to '/var/lib/
DEBUG: Executing /usr/lib/
DEBUG: Executing /usr/lib/
Creating .src.rpm ...DEBUG: Executing /usr/lib/
.
DEBUG: resulting srpm: myprog-
DEBUG: copying '/var/lib/
Traceback (most recent call last):
File "/usr/bin/mach", line 2444, in <module>
main (config, sys.argv[1:])
File "/usr/bin/mach", line 2413, in main
output = Root.__
File "/usr/bin/mach", line 951, in build
os.unlink (srpmfile)
OSError: [Errno 13] Permission denied: '/var/lib/
I think the error is that line 951 is simply os.unlink(srpmfile) and is not wrapped by anything.
The file in question is owned by root:root, so my normal user cannot unlink it.
I think a solution would be to either handle the unlink command inside the chroot environment, or to make sure the generated srpm is at least group owned by mach.