Bug 1386544 - bind mounting a dir to homedir wipes the dir (outside chroot) when cleaning
Summary: bind mounting a dir to homedir wipes the dir (outside chroot) when cleaning
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michael Simacek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-19 08:47 UTC by Michael Simacek
Modified: 2017-01-20 20:47 UTC (History)
6 users (show)

Fixed In Version: mock-1.3.3-1.fc25 mock-1.3.3-1.fc24 mock-1.3.3-1.el7 mock-1.3.3-1.el6
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-06 07:51:59 UTC
Type: Bug


Attachments (Terms of Use)

Description Michael Simacek 2016-10-19 08:47:57 UTC
Description of problem:
If I mount a directory into chroot using bind_mount plugin that has the target within build users home (/builddir by default), the directory contents get wiped when the buildroot is cleaned.

Version-Release number of selected component (if applicable):
mock-1.2.21-1.fc24.noarch

How reproducible:
always

Steps to Reproduce:
1. mkdir ~/somedir; touch ~/somedir/foo
2. Add the following to mock config:
config_opts['plugin_conf']['bind_mount_enable'] = True
import os
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append((os.path.expanduser('~/.somedir'), '/builddir/somedir' ))
3. build something in given chroot

Actual results:
~/somedir/foo gets deleted

Expected results:
~/somedir contents are left untouched

Additional info:
I think mock should either move the mount execution to later phase (after cleaning) or use an equivalent of rm --one-filesystem when deleting.

Comment 1 Miroslav Suchý 2016-10-20 14:18:35 UTC
This is expected behaviour. See relevant part from siteconfig.cfg

# The build user's homedir is partially cleaned up even when --no-clean is
# specified in order to prevent garbage from previous builds from altering
# successive builds. Mock can be configured to exclude certain files/directories
# from this. Default is SOURCES directory to support nosrc rpms. Paths are
# relative to build user's homedir
# config_opts['exclude_from_homedir_cleanup'] = ['build/SOURCES']

I will rather add this information to wiki documenting mount plugin.

Comment 2 Miroslav Suchý 2016-10-20 14:27:40 UTC
Done. See https://github.com/rpm-software-management/mock/wiki/Plugin-Mount

Comment 3 Michael Simacek 2016-10-21 08:30:36 UTC
(In reply to Miroslav Suchý from comment #1)
> This is expected behaviour. See relevant part from siteconfig.cfg
> 
> # The build user's homedir is partially cleaned up even when --no-clean is
> # specified in order to prevent garbage from previous builds from altering
> # successive builds. Mock can be configured to exclude certain
> files/directories
> # from this. Default is SOURCES directory to support nosrc rpms. Paths are
> # relative to build user's homedir
> # config_opts['exclude_from_homedir_cleanup'] = ['build/SOURCES']
> 
> I will rather add this information to wiki documenting mount plugin.

I don't think that documenting is enough. After all, I'm the one who was reimplementing the cleanup logic (and the exclusions) during GSoC, so I knew all that already. And yet, I deleted my data this way. Because when using something as simple as mount plugin, people don't expect it will rm -rf their data outside of mock chroot. If you don't want to work on this, I'll try to prepare a solution myself.

Comment 4 Miroslav Suchý 2016-10-24 07:37:27 UTC
> I'll try to prepare a solution myself.

Fair enough.

Comment 5 Michael Simacek 2016-10-24 09:51:21 UTC
Submitted: https://github.com/rpm-software-management/mock/pull/13

BTW, the exclusions didn't help with the problem, so you should revert the suggestion in the docs.

Comment 6 Fedora Update System 2017-01-01 12:25:21 UTC
mock-1.3.3-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1c15f1fddc

Comment 7 Fedora Update System 2017-01-01 12:25:52 UTC
mock-1.3.3-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-5947ef9fd1

Comment 8 Fedora Update System 2017-01-01 12:26:24 UTC
mock-1.3.3-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-77cb570c74

Comment 9 Fedora Update System 2017-01-01 12:26:57 UTC
mock-1.3.3-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-3b5bb282f4

Comment 10 Fedora Update System 2017-01-02 00:46:30 UTC
mock-1.3.3-1.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1c15f1fddc

Comment 11 Fedora Update System 2017-01-02 00:48:14 UTC
mock-1.3.3-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-3b5bb282f4

Comment 12 Fedora Update System 2017-01-02 01:19:58 UTC
mock-1.3.3-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-77cb570c74

Comment 13 Fedora Update System 2017-01-02 01:50:16 UTC
mock-1.3.3-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5947ef9fd1

Comment 14 Fedora Update System 2017-01-06 07:51:59 UTC
mock-1.3.3-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2017-01-09 01:20:50 UTC
mock-1.3.3-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2017-01-16 17:21:54 UTC
mock-1.3.3-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 17 Fedora Update System 2017-01-20 20:47:43 UTC
mock-1.3.3-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.