Bug 1208299 - mock archives bind mounts in root cache tar file
Summary: mock archives bind mounts in root cache tar file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 21
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-01 21:57 UTC by sysedpks
Modified: 2015-06-20 21:13 UTC (History)
6 users (show)

Fixed In Version: mock-1.2.10-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-05-01 16:51:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description sysedpks 2015-04-01 21:57:17 UTC
Description of problem:


Adding bind mount directory in plugin dir config does not correctly exclude from tar file root cache archive.

Version-Release number of selected component (if applicable):
1.2.7-1.fc21.noarch

How reproducible:
Always

Steps to Reproduce:
1. add a mount point in /etc/mock/MYCONFIG.cfg:
   config_opts['plugin_conf']['bind_mount_opts']['dirs'].append('/srcdir','/binddir'))
2. mock --scrub=all; mock --verbose --trace --init
3. tar tzvf cache_topdir/MYCONFIG/root_cache/archive.tar.gz | grep /binddir

Actual results:
archive.tar.gz has /binddir and all its subdirectories

Expected results:
/binddir and its subdirectories should not be added in archive.tar.gz

Additional info:
I use a custom config_opts['basedir']='/MOCKBASEDIR' and config_opts['cache_topdir']='/MOCKBASEDIR/cache'

The output of mock --verbose --trace shows that the /binddir is excluded, but instead of in the form of "--exclude ./binddir" as in other directories, it has the form "--exclude /MOCKBASEDIR/root/binddir". I believe this is incorrect.

There is a workaround: for each bind directory, add a copy in cache_root plugin exclude_dir manually in the configuration.

Comment 1 sysedpks 2015-04-01 22:14:24 UTC
Just to let you know, the source directory and mock base are in the same filesystem, so --one-file-system option of tar wouldn't have excluded the bind mount directory.

Comment 2 Miroslav Suchý 2015-04-10 16:17:42 UTC
I could not reproduce.
$ sudo mkdir /foobar
$ sudo touch /foobar/bar
$ cp /etc/mock/fedora-21-x86_64.cfg /tmp/my-fedora-21-x86_64.cfg

I put at the top of /tmp/my-fedora-21-x86_64.cfg:
config_opts['plugin_conf']['bind_mount_enable'] = True
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/foobar','/binddir'))


$ mock --scrub=all -r /tmp/my-fedora-21-x86_64.cfg
$ ls /var/cache/mock/fedora-21-x86_64/root_cache/cache.tar.gz
ls: cannot access /var/cache/mock/fedora-21-x86_64/root_cache/cache.tar.gz: No such file or directory
$ mock  -r /tmp/my-fedora-21-x86_64.cfg --init
....

$ tar tzvf /var/cache/mock/fedora-21-x86_64/root_cache/cache.tar.gz |grep bindir
$ ls -l /var/cache/mock/fedora-21-x86_64/root_cache/cache.tar.gz
-rw-rw-r-- 1 root mock 170400232 Apr 10 18:10 /var/cache/mock/fedora-21-x86_64/root_cache/cache.tar.gz

Ahh.. you are using different basedir and cache_topdir. This will be the cause. Looking into it.

Comment 3 Miroslav Suchý 2015-04-10 16:34:58 UTC
Oh I have typo in that grep.
So I can reproduce it even without moving basedir and cache_topdir.

tar tzvf /var/cache/mock/fedora-21-x86_64/root_cache/cache.tar.gz |grep binddir
drwxr-xr-x root/root         0 2015-04-10 17:58 ./binddir/
-rw-r--r-- root/root         0 2015-04-10 17:58 ./binddir/bar

Comment 4 Miroslav Suchý 2015-04-10 16:42:38 UTC
Notes for myself:
self.exclude_tar_cmds is:
['--exclude=./proc', '--exclude=./sys', '--exclude=./dev', '--exclude=./tmp/ccache', '--exclude=./var/cache/yum', '--exclude=./var/lib/mock/fedora-21-x86_64/root/proc', '--exclude=./var/lib/mock/fedora-21-x86_64/root/sys', '--exclude=./var/lib/mock/fedora-21-x86_64/root/dev/shm', '--exclude=./var/lib/mock/fedora-21-x86_64/root/dev/pts', '--exclude=./var/lib/mock/fedora-21-x86_64/root/var/cache/yum', '--exclude=./var/lib/mock/fedora-21-x86_64/root/binddir', '--exclude=./var/lib/mock/fedora-21-x86_64/root/tmp/ccache']

so we should not pass source of mount but destination of mount.

Comment 5 Miroslav Suchý 2015-04-15 15:54:24 UTC
Fixed in:
* 13ebf5a if mountpoint is inside chroot, remove chroot part [RHBZ#1208299]

Comment 6 Fedora Update System 2015-04-29 13:17:00 UTC
mock-1.2.8-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.fc22

Comment 7 Fedora Update System 2015-04-29 13:17:24 UTC
mock-1.2.8-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.fc21

Comment 8 Fedora Update System 2015-04-29 13:18:23 UTC
mock-1.2.8-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.fc20

Comment 9 Fedora Update System 2015-04-29 13:19:29 UTC
mock-1.2.8-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.el7

Comment 10 Fedora Update System 2015-04-29 13:25:35 UTC
mock-1.2.8-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.el6

Comment 11 Fedora Update System 2015-04-29 19:19:14 UTC
Package mock-1.2.8-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.8-1.el7'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2015-6057/mock-1.2.8-1.el7
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2015-05-01 16:51:20 UTC
mock-1.2.8-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2015-05-02 18:08:59 UTC
mock-1.2.8-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-05-12 20:46:50 UTC
mock-1.2.8-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-06-04 11:41:57 UTC
mock-1.2.10-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.10-1.el7

Comment 16 Fedora Update System 2015-06-04 11:42:49 UTC
mock-1.2.10-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.10-1.el6

Comment 17 Fedora Update System 2015-06-20 21:10:25 UTC
mock-1.2.10-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.

Comment 18 Fedora Update System 2015-06-20 21:13:19 UTC
mock-1.2.10-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.


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