Bug 1298751 - Permission issues when building from an external source directory
Summary: Permission issues when building from an external source directory
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: mock
Version: el6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-14 22:29 UTC by Jon McKenzie
Modified: 2020-02-08 16:35 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-02-08 16:35:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1178576 0 unspecified CLOSED SCM builds fail with "IOError: [Errno 13] Permission Denied: /tmp/foo.mock-scm.bar/bar/bar.spec" 2021-02-22 00:41:40 UTC

Description Jon McKenzie 2016-01-14 22:29:55 UTC
Description of problem:

There still seems to be permissions issues with the SRPM build process (similar to RHBZ#1178576). If you prebuild a source tarball, owned 0600 as yourself, and try to run a build using an external source dir, the source tarball is copied into /tmp using 0600 perms except owned root:root. Later on, mock attempts to copy the /tmp src tarball (now owned by root) into your chroot, except this is run as yourself, resulting in an EACCES. If you then chmod the original src tarball as 0644 (rather than 0600), the tarball copied into /tmp then has 0644 root:root permissions, allowing you to read it, and the build succeeds.

Explicitly:

Say you have a src tarball /path/to/your/SOURCES/somepkg-1.0.0.tar.gz owned by your mock build user (say, johndoe:johndoe) with 0600 permissions.

Now run mock using that ext_src_dir:

mock --scm-enable --scm-option method=git --scm-option git_get="git clone git@gitserver:somepkg.git" --scm-option branch=master --scm-option spec=somepkg.spec --scm-option package=somepkg --scm-option ext_src_dir=/path/to/your/SOURCES -v

The build will fail with an EACCES on a shutil.copytree copying the tarball from /tmp into your chroot /builddir/build/SOURCES

(I'm building on a disconnected network, so sorry I don't have a full traceback, but here's a truncated version:

...snip...
/usr/sbin/mock, line 511, in do_buildsrpm
/usr/lib/python2.6/site-packages/mockbuild/trace_decorator.py, line 84, in trace
/usr/sbin/mock, line 440, in rebuild_generic
/usr/sbin/mock, line 509, in cmd
/usr/lib/python2.6/site-packages/mockbuild/trace_decorator.py, line 84, in trace
/usr/lib/python2.6/site-packages/mockbuild/backend.py, line 325, in buildsrpm
/usr/lib64/python2.6/shutil.py, line 173, in copytree
)


Version-Release number of selected component (if applicable):

mock-1.2.13

Comment 2 Tomas Smetana 2016-04-11 13:56:14 UTC
Hi,
  mock is not supported on RHEL, this bug should have been filed for EPEL.

Comment 3 Miroslav Suchý 2016-08-08 22:45:33 UTC
I believe this is duplicate of bug 1301985. Which has been resolved in mock-1.2.18.

I cannot reproduce it anymore.

Can you please try it with recent mock and confirm that it is resolved now?

Comment 4 Pavel Raiskup 2020-02-08 16:35:02 UTC
Closing for inactivity.  Please reopen if this is still reproducible.


Note You need to log in before you can comment on or make changes to this bug.