Bug 1178576 - SCM builds fail with "IOError: [Errno 13] Permission Denied: /tmp/foo.mock-scm.bar/bar/bar.spec"
Summary: SCM builds fail with "IOError: [Errno 13] Permission Denied: /tmp/foo.mock-sc...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 21
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-05 00:14 UTC by Scott K Logan
Modified: 2015-02-20 00:33 UTC (History)
9 users (show)

Fixed In Version: mock-1.2.6-1.el6
Clone Of:
Environment:
Last Closed: 2015-01-21 23:09:03 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Backtrace of error (1.80 KB, text/plain)
2015-01-05 00:14 UTC, Scott K Logan
no flags Details
Correct permissions for tmp scm directory (872 bytes, patch)
2015-01-06 14:30 UTC, Mikhail Campos
no flags Details | Diff

Description Scott K Logan 2015-01-05 00:14:17 UTC
Created attachment 976145 [details]
Backtrace of error

Description of problem:
Mock fails to build perform --buildsrpm from a git repository using the scm option.

This is a regression from mock-1.1.41-3.fc21 to mock-1.2.1-1.fc21

The intermediate cause is that /tmp/foo.mock-scm.bar has ownership root:root and has chmod 0700, and mock tries to read the contents with some other rights (user that triggered the build?)

For example, the following command fails:
mock --buildsrpm --scm-enable --scm-option git_get='git clone https://some-git-repo.git package-name' --scm-option package=package-name --scm-option branch=f21 --scm-option write_tar=True --scm-option spec=package-name.spec

While the following *workaround* succeeds in building:
mock --buildsrpm --scm-enable --scm-option git_get='bash -c "git clone https://some-git-repo.git package-name && chmod a+rx ."' --scm-option package=package-name --scm-option branch=f21 --scm-option write_tar=True --scm-option spec=package-name.spec

Version-Release number of selected component (if applicable): mock-1.2.1-1.fc21 and newer

How reproducible: 100%

Steps to Reproduce:
1. Attempt to build from SCM

Actual results:
Build fails with "Permission denied"

Expected results:
Build succeeds as it did before

Additional info:
Backtrace attached.

Comment 1 Mikhail Campos 2015-01-06 14:28:26 UTC
In mock-1.1.41-3.fc21 _becomeUser(0,0) called after scm get_sources() function (where tmp directory is created), so the owner of tmp dir was user that started the build.

Comment 2 Mikhail Campos 2015-01-06 14:30:34 UTC
Created attachment 976829 [details]
Correct permissions for tmp scm directory

Proposed patch attached

Comment 3 Miroslav Suchý 2015-01-07 09:32:59 UTC
Thanks Mikhail for proposed patch, however I would say that rather than chmod 755 it is better to drop and restore privs around scmWorker.get_sources() - command copyout do the same.

Commit 4702ce9

Comment 4 Fedora Update System 2015-01-16 09:56:40 UTC
mock-1.2.4-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.4-1.fc21

Comment 5 Fedora Update System 2015-01-16 09:57:18 UTC
mock-1.2.4-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.4-1.fc20

Comment 6 Fedora Update System 2015-01-16 10:01:04 UTC
mock-1.2.4-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.4-1.el7

Comment 7 Fedora Update System 2015-01-16 10:01:42 UTC
mock-1.2.4-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.4-1.el6

Comment 8 Fedora Update System 2015-01-16 19:10:22 UTC
Package mock-1.2.4-1.el7:
* should fix your issue,
* was pushed to the Fedora EPEL 7 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing mock-1.2.4-1.el7'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2015-0312/mock-1.2.4-1.el7
then log in and leave karma (feedback).

Comment 9 Mathieu Baudier 2015-01-18 20:55:11 UTC
I had this issue (on CentOS 6.6 x86_64), and I installed mock 1.2.4-1.el6 from epel-testing, which indeed fixed the authorizations pb.

But now, I get this error and it cannot start the actual build on the SRPM generated from the git repository :

CRITICAL: No package specified to rebuild command.

Looking at the /usr/sbin/mock script it seems that do_buildsrpm() returns an empty string

    elif options.mode == 'rebuild':
        if config_opts['scm']:
            srpm = do_buildsrpm(config_opts, commands, buildroot, options, args)
            log.info(srpm)
            if srpm:
                args.append(srpm)
            scmWorker.clean()
        do_rebuild(config_opts, commands, buildroot, args)

# Note: I added log.info(srpm)

Should I open a new bug or is it a side effect of this one?

To reproduce:
Git: git://elgis.argeo.org/geos.git
Sources: http://download.osgeo.org/geos/geos-3.4.2.tar.bz2

/usr/bin/mock -v -r epel-6-x86_64 --scm-enable --scm-option package=geos --no-clean

# added to epel-6-x86_64.cfg
config_opts['scm_opts']['method'] = 'git'
config_opts['scm_opts']['spec'] = 'SCM_PKG.spec'
config_opts['scm_opts']['ext_src_dir'] = '/home/mbaudier/dev/git/elgis.argeo.org/sources'
config_opts['scm_opts']['git_timestamps'] = True
config_opts['scm_opts']['git_get'] = 'git clone -b elgis6 file:////home/mbaudier/dev/git/elgis.argeo.org//SCM_PKG SCM_PKG'

More log:

...
Wrote: /builddir/build/SRPMS/geos-3.4.2-3.el6.src.rpm
DEBUG: Child return code was: 0
INFO: LEAVE do --> 

Finish: rpmbuild -bs
DEBUG: Copying package to result dir
Finish: buildsrpm
INFO: Done(/tmp/tmpbwIga9.mock-scm.geos/geos/geos.spec) Config(epel-6-x86_64) 0 minutes 1 seconds
INFO: Results and/or logs in: /var/lib/mock/epel-6-x86_64/result
INFO: None
DEBUG: Clean SCM checkout directory
CRITICAL: No package specified to rebuild command.
DEBUG: kill orphans
...

Comment 10 Miroslav Suchý 2015-01-19 08:31:21 UTC
1) this is different issue
2) it is NOTABUG, because git://elgis.argeo.org/geos.git is not git, but dist-git. And to get the tar.gz you are not doing git-archive (which SCM plugin does) but "fedpkg sources"

Comment 11 Mathieu Baudier 2015-01-19 09:40:04 UTC
There seems to be a misunderstanding: the git repo is cloned locally and the archive is downloaded manually (I just put the online URLs in order to help reproduce)

The related properties in the mock .cfg file are:

config_opts['scm_opts']['method'] = 'git'
config_opts['scm_opts']['spec'] = 'SCM_PKG.spec'
config_opts['scm_opts']['ext_src_dir'] = '/home/mbaudier/dev/git/elgis.argeo.org/sources'
config_opts['scm_opts']['git_timestamps'] = True
config_opts['scm_opts']['git_get'] = 'git clone -b elgis6 file:////home/mbaudier/dev/git/elgis.argeo.org//SCM_PKG SCM_PKG'

The local git repos are located at:
/home/mbaudier/dev/git/elgis.argeo.org/<my package>

and the sources at:
/home/mbaudier/dev/git/elgis.argeo.org/sources

The SRPM is properly generated (cf. log above), so the SCM plugin is doing its job. It seems just that the path (?) to the generated SRPM is not passed to the next step (that is, the rebuild itself).

Sorry to insist, but I have been using mock for years and this used to work (our Enterprise Linux GIS build scripts wrapping mock are now broken). Either I have indeed made a stupid configuration mistake, or something has changed, or something is wrong.

Comment 12 Miroslav Suchý 2015-01-19 10:29:14 UTC
Can you please open new BZ for that, so we do not pollute this one?

Comment 13 Fedora Update System 2015-01-21 23:09:03 UTC
mock-1.2.4-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2015-01-27 03:04:33 UTC
mock-1.2.4-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2015-01-28 15:20:23 UTC
mock-1.2.5-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.5-1.el7

Comment 16 Fedora Update System 2015-01-28 15:21:39 UTC
mock-1.2.5-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.5-1.el6

Comment 17 Fedora Update System 2015-01-28 15:22:51 UTC
mock-1.2.5-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.5-1.fc20

Comment 18 Fedora Update System 2015-01-28 15:24:01 UTC
mock-1.2.5-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.5-1.fc21

Comment 19 Fedora Update System 2015-02-02 17:22:27 UTC
mock-1.2.5-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2015-02-03 04:42:17 UTC
mock-1.2.6-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.6-1.el6

Comment 21 Fedora Update System 2015-02-03 04:42:53 UTC
mock-1.2.6-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.6-1.el7

Comment 22 Fedora Update System 2015-02-03 04:43:44 UTC
mock-1.2.6-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.6-1.fc20

Comment 23 Fedora Update System 2015-02-03 04:44:16 UTC
mock-1.2.6-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.6-1.fc21

Comment 24 Matt McCutchen 2015-02-08 01:11:59 UTC
> CRITICAL: No package specified to rebuild command.

I have filed bug 1190450 for the above.

Comment 25 Fedora Update System 2015-02-09 05:29:32 UTC
mock-1.2.6-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 26 Fedora Update System 2015-02-15 02:55:54 UTC
mock-1.2.6-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 27 Fedora Update System 2015-02-20 00:32:42 UTC
mock-1.2.6-1.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 28 Fedora Update System 2015-02-20 00:33:38 UTC
mock-1.2.6-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.


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