RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1323165 - Handling of parameters to atomic install regressed
Summary: Handling of parameters to atomic install regressed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: atomic
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Brent Baude
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-01 12:27 UTC by Jan Pazdziora
Modified: 2016-06-23 16:21 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-23 16:21:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1273 0 normal SHIPPED_LIVE atomic bug fix and enhancement update 2016-06-23 20:13:11 UTC

Description Jan Pazdziora 2016-04-01 12:27:19 UTC
Description of problem:

With atomic 1.9, parameters are no longer passed to install.sh correctly.

Version-Release number of selected component (if applicable):

atomic-1.9-4.gitff44c6a.el7.x86_64
docker-1.9.1-25.el7.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. Have atomic-test/Dockerfile with content

FROM rhel7
COPY install.sh /bin/
RUN chmod +x /bin/install.sh
LABEL INSTALL 'docker run --rm=true --net=host -v /:/host -e NAME=${NAME} -e IMAGE=${IMAGE} -e HOST=/host ${IMAGE} /bin/install.sh'

2. Have atomic-test/install.sh with content

#!/bin/bash
echo Parameters:
for i in "$@" ; do
	echo "  $i"
done

3. Run docker build -t atomic-test ~/atomic-test
4. Run atomic install atomic-test jezek 'asdf jkl'

Actual results:

docker run --rm=true --net=host -v /:/host -e NAME=atomic-test -e IMAGE=atomic-test -e HOST=/host atomic-test /bin/install.sh jezek 'asdf jkl'
Parameters:
  jezek
  'asdf
  jkl'

Expected results:

docker run --rm=true --net=host -v /:/host -e NAME=atomic-test -e IMAGE=atomic-test -e HOST=/host atomic-test /bin/install.sh jezek 'asdf jkl'
Parameters:
  jezek
  asdf jkl

Additional info:

The expected result comes from atomic-1.6-6.gitca1e384.el7.x86_64 / docker-1.8.2-10.el7.x86_64.

Comment 1 Jan Pazdziora 2016-04-01 12:31:20 UTC
Another example:

# atomic install atomic-test 'asdf&jkl'
docker run --rm=true --net=host -v /:/host -e NAME=atomic-test -e IMAGE=atomic-test -e HOST=/host atomic-test /bin/install.sh 'asdf&jkl'
Parameters:
  'asdf&jkl'

vs. the correct

# atomic install atomic-test 'asdf&jkl'
docker run --rm=true --net=host -v /:/host -e NAME=atomic-test -e IMAGE=atomic-test -e HOST=/host atomic-test /bin/install.sh 'asdf&jkl'
Parameters:
  asdf&jkl

Comment 2 Jan Pazdziora 2016-04-01 12:32:17 UTC
Also, there is regression with the non-US-ASCII character handling, compared to atomic 1.8 (see bug 1307034 command 4):

# atomic install atomic-test ježek
'ascii' codec can't decode byte 0xc5 in position 3: ordinal not in range(128)

Comment 5 Jan Pazdziora 2016-04-01 12:42:47 UTC
Even just plain

LABEL INSTALL 'bash -c "echo arg1 arg2"'

seems to be broken now:

# atomic install atomic-test
bash -c "echo arg1 arg2"
arg1: -c: line 0: unexpected EOF while looking for matching `"'
arg1: -c: line 1: syntax error: unexpected end of file

vs. the original (and correct)

# atomic install atomic-test
bash -c echo arg1 arg2
arg1 arg2

with atomic-1.6-6.gitca1e384.el7.x86_64.

Comment 6 Daniel Walsh 2016-04-04 18:12:17 UTC
Jan could you check out

https://github.com/projectatomic/atomic/pull/336

Comment 7 Jan Pazdziora 2016-04-21 12:58:53 UTC
(In reply to Daniel Walsh from comment #6)
> Jan could you check out
> 
> https://github.com/projectatomic/atomic/pull/336

Yes, that patch fixes cases from comment 0, comment 1, and comment 5.

The ascii codec issues from comment 2 is still present.

Comment 8 Brent Baude 2016-04-21 20:58:25 UTC
@Jan,

Would it be possible for you to pull my atomic_ascii branch and see if it passes comment #2 now?  Might also be worth checking that the other use cases are also valid.

https://github.com/baude/atomic/tree/atomic_ascii

Comment 9 Jan Pazdziora 2016-04-22 06:54:10 UTC
Applying just the 7e34f5d7cd6b2a57d855d1faba22c041e02182bc on top of atomic-1.9-4.gitff44c6a.el7.x86_64 and https://github.com/projectatomic/atomic/pull/336 does not resolve the

'ascii' codec can't decode byte 0xc5 in position 3: ordinal not in range(128)

issue.

I also wonder why you specifically target UTF-8 there. While it likely is the encoding that the majority will use, atomic should not really care about the encoding at all -- just pass verbatim whatever parameters there are on the command line.

Comment 10 Daniel Walsh 2016-04-25 14:23:04 UTC
We should add this to the test suite to make sure we handle this situation.

Comment 11 Daniel Walsh 2016-04-25 14:27:12 UTC
Jan what code are you referring to exactly for "utf-8"  Could you submit a patch.

Comment 13 Daniel Walsh 2016-04-25 15:14:28 UTC
Jan please review

https://github.com/projectatomic/atomic/pull/358

Comment 14 Daniel Walsh 2016-04-25 15:58:03 UTC
Jan so you are saying there is no need for

 -        return " ".join(args)
+        return " ".join([x.decode('utf-8') for x in args])


Is this code alright?


 +    # break command into list
+    try:
         cmd = shlex.split(cmd)
+    except UnicodeEncodeError:
+        # The command contains a non-ascii character
+        cmd = shlex.split(" ".join([x.encode('utf-8') for x in cmd.split()]))

Comment 15 Jan Pazdziora 2016-04-29 10:23:38 UTC
(In reply to Daniel Walsh from comment #14)
> Jan so you are saying there is no need for
> 
>  -        return " ".join(args)
> +        return " ".join([x.decode('utf-8') for x in args])
> 
> 
> Is this code alright?

I really don't know, I'm not expert on encodings in python.

But if you do

echo malá | iconv -f utf8 -t iso88591 | xargs echo

you will get ISO-8859-1 character (single byte) which is not UTF-8 (try piping to od -c). I'm not sure what the situation with non-UTF-8 is in Asian parts of the world.

Comment 16 Daniel Walsh 2016-04-29 18:42:34 UTC
 atomic install atomic-test ježek 'foo bar'docker run --rm=true --net=host -v /:/host -e NAME=atomic-test -e IMAGE=atomic-test -e HOST=/host atomic-test /bin/install.sh 'ježek' 'foo bar'
ježek
foo bar

So this is what we currently have?  Jan what should the output be?

Comment 17 Jan Pazdziora 2016-04-30 15:16:45 UTC
The output looks good.

Thank you.

Comment 18 Daniel Walsh 2016-06-03 19:49:52 UTC
Fixed in atomic-1.10

Comment 19 Jan Pazdziora 2016-06-07 16:56:27 UTC
I confirm that cases from comment 0, comment 1, comment 2, and comment 5 now give expected results with

python-docker-py-1.7.2-1.el7.noarch
atomic-1.10.3-2.el7.x86_64

Comment 21 Alex Jia 2016-06-12 09:02:18 UTC
Moving the bug to VERIFIED status per Comment 19 and actually testing on atomic-1.10.3-2 and atomic-1.10.5-3 w/ python-docker-py-1.7.2-1.

Comment 23 errata-xmlrpc 2016-06-23 16:21:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1273


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