Bug 640643 - /bin/sh: -c: line 0: syntax error near unexpected token `('
Summary: /bin/sh: -c: line 0: syntax error near unexpected token `('
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 13
Hardware: x86_64
OS: Linux
low
low
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-10-06 14:46 UTC by Jan Kratochvil
Modified: 2013-01-10 06:15 UTC (History)
3 users (show)

Fixed In Version: mock-1.1.10-1.fc14.noarch
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-31 18:56:08 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jan Kratochvil 2010-10-06 14:46:50 UTC
Description of problem:
mock does not transparently escape the passed commands/parameters.
copy-paster a list of requirements, quoted them by 's and it does not work.

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

How reproducible:
Always.

Steps to Reproduce:
mock -v -r fedora-14-x86_64 --install 'kde4-macros(api)'

Actual results:
DEBUG: Executing command: /usr/bin/yum --installroot /var/lib/mock/fedora-14-x86_64/root/  install kde4-macros(api)
DEBUG: /bin/sh: -c: line 0: syntax error near unexpected token `('
DEBUG: /bin/sh: -c: line 0: `/usr/bin/yum --installroot /var/lib/mock/fedora-14-x86_64/root/  install kde4-macros(api)'
DEBUG: Child returncode was: 1

Expected results:
Installed kde-filesystem rpm.

Additional info:
mock -r fedora-14-x86_64 --shell yum install 'kde4-macros(api)' 
fails with:
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `PS1='mock-chroot> ' /usr/sbin/chroot  /var/lib/mock/fedora-14-x86_64/root/ yum install kde4-macros(api)'

But:
mock -r fedora-14-x86_64 --shell 
mock-chroot> yum install 'kde4-macros(api)' 
Installed:
  kde-filesystem.noarch 0:4-35.fc13

Comment 1 Clark Williams 2011-02-20 19:38:46 UTC
the quotes get stripped from input parameters when invoked from the shell. 

if you've got a package name with shell metacharacters in them, you'll need to escape the quotes so that they get passed in as part of the package name:

mock -v -r fedora-14-x86_64 --install \'kde4-macros(api)\'

Comment 2 Jan Kratochvil 2011-02-21 10:10:32 UTC
(In reply to comment #1)
> the quotes get stripped from input parameters when invoked from the shell.

Yes, mock gets it correctly:

argc = 6
argv[0] = <mock>
argv[1] = <-v>
argv[2] = <-r>
argv[3] = <fedora-14-x86_64>
argv[4] = <--install>
argv[5] = <kde4-macros(api)>


> if you've got a package name with shell metacharacters in them, you'll need to
> escape the quotes so that they get passed in as part of the package name:
> 
> mock -v -r fedora-14-x86_64 --install \'kde4-macros(api)\'

Yes, but this is a workaround of a mock bug.  Caller of mock does not know and should not know how the arguments get processed internally in mock.  Caller of mock passed the parameters correctly.

If mock needs it mock has to escape the parameters on its own.

I do not mind but if this bug remains in mock it is WONTFIX, not NOTABUG.

Comment 3 Fedora Admin XMLRPC Client 2011-03-11 18:10:20 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Clark Williams 2011-05-06 20:42:55 UTC
I would accept a patch that escapes the input arguments to be safe to passing to yum via the shell.

Comment 5 Bug Zapper 2011-05-31 11:52:15 UTC
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 6 Jan Kratochvil 2011-05-31 18:56:08 UTC
Unaware since which fix but it works now, thanks.

32067 execve("/usr/bin/yum", ["/usr/bin/yum", "--installroot", "/var/lib/mock/fedora-14-x86_64/r"..., "install", "kde4-macros(api)"], [/* 9 vars */] <unfinished ...>


DEBUG: ['/usr/bin/yum', '--installroot', '/var/lib/mock/fedora-14-x86_64/root/', 'install', 'kde4-macros(api)']
DEBUG: Executing command: ['/usr/bin/yum', '--installroot', '/var/lib/mock/fedora-14-x86_64/root/', 'install', 'kde4-macros(api)']
DEBUG: ================================================================================
DEBUG:  Package                Arch           Version             Repository      Size
DEBUG: ================================================================================
DEBUG: Installing:
DEBUG:  kde-filesystem         noarch         4-35.fc13           fedora          46 k
DEBUG: Transaction Summary
DEBUG: ================================================================================
DEBUG: Install       1 Package(s)
DEBUG: Total download size: 46 k
DEBUG: Installed size: 3.7 k
DEBUG: Installed:
DEBUG:   kde-filesystem.noarch 0:4-35.fc13                                             
DEBUG: Child returncode was: 0
INFO: 
================================================================================
 Package                Arch           Version             Repository      Size
================================================================================
Installing:
 kde-filesystem         noarch         4-35.fc13           fedora          46 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 46 k
Installed size: 3.7 k

Installed:
  kde-filesystem.noarch 0:4-35.fc13


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