rpm-software-management / mock

Mock is a tool for a reproducible build of RPM packages.
GNU General Public License v2.0
384 stars 235 forks source link

Mock resultdir created by chroot_scan plugin has weird permissions #1467

Closed praiskup closed 2 months ago

praiskup commented 2 months ago

Two subsequent calls of mockchain fail with:

$ mockchain /tmp/tito/python-copr-1.132-1.git.75.658230d.fc41.src.rpm /tmp/tito/copr-cli-1.112-1.git.78.658230d.fc41.src.rpm

## mockchain is deprecated, use mock --chain instead ##

INFO: mock.py version 5.6.post1 starting (python version = 3.13.0, NVR = mock-5.6.post1-1.git.3802.3dd0024.fc41), args: /usr/libexec/mock/mock --chain /tmp/tito/python-copr-1.132-1.git.75.658230d.fc41.src.rpm /tmp/tito/copr-cli-1.112-1.git.78.658230d.fc41.src.rpm
Start(bootstrap): init plugins
INFO: tmpfs initialized
INFO: selinux enabled
INFO: chroot_scan: initialized
Finish(bootstrap): init plugins
Start: init plugins
INFO: tmpfs initialized
INFO: selinux enabled
INFO: chroot_scan: initialized
Finish: init plugins
INFO: Signal handler active
Start: run
INFO: chroot_scan: 1 files copied to /var/lib/mock/fedora-41-x86_64/result/chroot_scan
INFO: /var/lib/mock/fedora-41-x86_64/root/var/log/dnf5.log
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 1135, in <module>
    exitStatus = main()
  File "/usr/lib/python3.13/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock/mock", line 887, in main
    result = run_command(options, args, config_opts, commands, buildroot)
  File "/usr/lib/python3.13/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock/mock", line 930, in run_command
    commands.init(do_log=True)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.13/site-packages/mockbuild/backend.py", line 156, in init
    self.buildroot.resetLogging()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.13/site-packages/mockbuild/buildroot.py", line 648, in resetLogging
    fh = logging.FileHandler(fullPath, "a+")
  File "/usr/lib64/python3.13/logging/__init__.py", line 1218, in __init__
    StreamHandler.__init__(self, self._open())
                                 ~~~~~~~~~~^^
  File "/usr/lib64/python3.13/logging/__init__.py", line 1247, in _open
    return open_func(self.baseFilename, self.mode,
                     encoding=self.encoding, errors=self.errors)
PermissionError: [Errno 13] Permission denied: '/var/lib/mock/fedora-41-x86_64/result/state.log'
praiskup commented 2 months ago

The problem was caused by chroot_scan plugin (I have it enabled locally).