Description of problem: $ mock -r ruby22-rhel-7 --new-chroot --chroot 'rm /builddir/build/SRPMS/*' INFO: mock.py version 1.2.3 starting (python version = 2.7.8)... Start: init plugins INFO: selinux disabled Finish: init plugins Start: run Start: chroot init INFO: calling preinit hooks INFO: enabled yum cache Start: cleaning yum metadata Finish: cleaning yum metadata Finish: chroot init INFO: Running in chroot: rm /builddir/build/SRPMS/* Start: chroot rm /builddir/build/SRPMS/* Spawning container root on /var/lib/mock/ruby22-rhel-7/root. Press ^] three times within 1s to kill container. rm: cannot remove '/builddir/build/SRPMS/*': No such file or directory Container root failed with error code 1. Finish: chroot rm /builddir/build/SRPMS/* ERROR: Command failed. See logs for output. # /usr/bin/systemd-nspawn -D /var/lib/mock/ruby22-rhel-7/root rm /builddir/build/SRPMS/* $ mock -r ruby22-rhel-7 --chroot 'rm /builddir/build/SRPMS/*' INFO: mock.py version 1.2.3 starting (python version = 2.7.8)... Start: init plugins INFO: selinux enabled Finish: init plugins Start: run Start: chroot init INFO: calling preinit hooks INFO: enabled yum cache Start: cleaning yum metadata Finish: cleaning yum metadata Finish: chroot init INFO: Running in chroot: rm /builddir/build/SRPMS/* Start: chroot rm /builddir/build/SRPMS/* Finish: chroot rm /builddir/build/SRPMS/* Finish: run Version-Release number of selected component (if applicable): $ rpm -q mock mock-1.2.3-1.fc21.noarch How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: --new-chroot --chroot fails Expected results: --new-chroot --chroot should work Additional info:
It seems, that can't handle asterisks... Also, mock -r <config> --new-chroot --chroot "bash -c 'rm /builddir/build/SRPMS/*'" should work
It seems to me that /builddir/build/SRPMS/* does not exist (unless you use --no-clean). And rm then gives the same error as usually: $ mkdir /tmp/foo $ rm /tmp/foo/* rm: cannot remove ‘/tmp/foo/*’: No such file or directory $ echo $? 1 Seems as NOTABUG to me. If I am missing something, please reopen.
(In reply to Miroslav Suchý from comment #2) > It seems to me that /builddir/build/SRPMS/* does not exist (unless you use > --no-clean). And rm then gives the same error as usually: It exists, that is the point. I believe that Mikhail's explanation is correct.
Fixed in commit fb6328d Note the new part of documentation (which just reflect how the core originaly worked): --shell [COMMAND [ARGS...]] Run the specified command interactively within the chroot (no 'clean' is performed). If no command specified, /bin/sh is run. Note that COMMAND is shell expanded using shell in chroot. --chroot COMMAND [ARGS...] Run the specified command non-interactively within the chroot (no 'clean' is performed). Command output will be sent to the log files. Note that COMMAND is shell expanded only if there are no ARGS. Otherwise there is no shell expansion. So for example: mock -r ruby22-rhel-7 --new-chroot --chroot 'rm /builddir/build/SRPMS/*' will work, but mock -r ruby22-rhel-7 --new-chroot --chroot rm /builddir/build/SRPMS/\* will not work (because that are COMMAND + one ARG. And this two will work: mock -r ruby22-rhel-7 --new-chroot --shell rm /builddir/build/SRPMS/\* mock -r ruby22-rhel-7 --new-chroot --shell 'rm /builddir/build/SRPMS/*' And all examples above behave identically even with --old-chroot.
Thanks Miroslav. Nevertheless, I'd be fine if --shell always expands and --chroot never expands, but this exception: (In reply to Miroslav Suchý from comment #4) > --chroot COMMAND [ARGS...] > Run the specified command non-interactively within the > chroot (no 'clean' is performed). Command output will be sent to the log > files. Note that COMMAND is shell expanded only if there are > no ARGS. Otherwise there is no shell expansion. i.e. expanding in dependence of number of arguments is weird and I'd appreciate if you can remove it.
This exception have been in mock since 2011-10-12. I just documented it now.
The question is is it bug or feature. You say it is feature, I say it is bug. But we might disagree on this :)
I just want to keep potential regression as low as possible.
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
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
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
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
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).
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.
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.
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
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
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
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
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.
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
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
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
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
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.
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.
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.
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.