Bug 1174317 - --new-chroot --chroot fails
Summary: --new-chroot --chroot fails
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-15 15:58 UTC by Vít Ondruch
Modified: 2015-02-20 00:33 UTC (History)
7 users (show)

Fixed In Version: mock-1.2.6-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-21 23:08:59 UTC


Attachments (Terms of Use)

Description Vít Ondruch 2014-12-15 15:58:11 UTC
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:

Comment 1 Mikhail Campos 2014-12-15 16:57:22 UTC
It seems, that can't handle asterisks...

Also,
mock -r <config> --new-chroot --chroot "bash -c 'rm /builddir/build/SRPMS/*'"

should work

Comment 2 Miroslav Suchý 2015-01-05 08:36:23 UTC
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.

Comment 3 Vít Ondruch 2015-01-05 09:12:51 UTC
(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.

Comment 4 Miroslav Suchý 2015-01-08 13:08:02 UTC
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.

Comment 5 Vít Ondruch 2015-01-08 13:20:22 UTC
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.

Comment 6 Miroslav Suchý 2015-01-08 13:53:58 UTC
This exception have been in mock since 2011-10-12. I just documented it now.

Comment 7 Vít Ondruch 2015-01-08 14:09:24 UTC
The question is is it bug or feature. You say it is feature, I say it is bug. But we might disagree on this :)

Comment 8 Miroslav Suchý 2015-01-08 22:18:57 UTC
I just want to keep potential regression as low as possible.

Comment 9 Fedora Update System 2015-01-16 09:56:37 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 10 Fedora Update System 2015-01-16 09:57:15 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 11 Fedora Update System 2015-01-16 10:01:01 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 12 Fedora Update System 2015-01-16 10:01:39 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 13 Fedora Update System 2015-01-16 19:10:18 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 14 Fedora Update System 2015-01-21 23:08:59 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 15 Fedora Update System 2015-01-27 03:04:29 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 16 Fedora Update System 2015-01-28 15:20:13 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 17 Fedora Update System 2015-01-28 15:21:32 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 18 Fedora Update System 2015-01-28 15:22:41 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 19 Fedora Update System 2015-01-28 15:23:52 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 20 Fedora Update System 2015-02-02 17:22:23 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 21 Fedora Update System 2015-02-03 04:42:15 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 22 Fedora Update System 2015-02-03 04:42:51 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 23 Fedora Update System 2015-02-03 04:43:43 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 24 Fedora Update System 2015-02-03 04:44:14 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 25 Fedora Update System 2015-02-09 05:29:30 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:52 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:39 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:36 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.