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 1787584 - [BUG] Grubby prints sed error given some arguments
Summary: [BUG] Grubby prints sed error given some arguments
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: grubby
Version: 8.1
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: 8.0
Assignee: Bootloader engineering team
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2020-01-03 14:22 UTC by Oliver Falk
Modified: 2023-09-07 21:22 UTC (History)
4 users (show)

Fixed In Version: grubby-8.40-41.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 01:51:12 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
grubby-8.40-39.el8.x86_64.rpm (47.68 KB, application/x-rpm)
2020-05-04 13:16 UTC, Javier Martinez Canillas
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4502 0 None None None 2020-11-04 01:51:21 UTC

Description Oliver Falk 2020-01-03 14:22:04 UTC
Description of problem:
The same command line used to work on RHEL6 and RHEL7, but now on RHEL 8 it doesn't any longer.

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


How reproducible: Always.


Steps to Reproduce:
1. # grubby --add-kernel=foo --initrd=bar --copy-default --title 'rebuild' --bad-image-okay 
2. # grubby --update-kernel=foo --args="ks=https://sat/unattended/provision?token="
sed: -e expression #1, char 29: unknown option to `s'


Actual results:
Sed error printed. See step 2 above.


Expected results:
No sed error.


Additional info:
grubby --update-kernel=foo --args="ks=https://sat/unattended/provision?token" => does NOT print any sed error.

It seems to be a combination of slash ('/') + equal sign ('='). Therefore, basically, all kickstart URLs will probably trigger this.

Running grubby-bls under bash -x reveals the following:
# bash -x /usr/libexec/grubby/grubby-bls --update-kernel=foo --args="ks=https://sat/unattended/provision?token="
[ ... ]
++ for arg in ${add_args[*]}
++ arg='ks=https://sat/unattended/provision?token'
+++ echo 'ks=https://sat/unattended/provision?token='
+++ sed -E 's/(^|[[:space:]])ks=https://sat/unattended/provision?token(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g'
sed: -e expression #1, char 29: unknown option to `s'
[ ... ]


Customer case linked.

Comment 2 Petr Janda 2020-05-04 11:31:12 UTC
can be reproduced by reported args, but some issue is hidden on more lines

grubby --update-kernel=$KERNEL --args="/haha"
sed: -e expression #1, char 59: unknown option to `s'
or 
grubby --update-kernel=$KERNEL --args="x=/haha="
sed: -e expression #1, char 61: unknown option to `s'

Comment 5 Javier Martinez Canillas 2020-05-04 13:16:50 UTC
Created attachment 1684818 [details]
grubby-8.40-39.el8.x86_64.rpm

Could you please test with the attached test build?

Comment 6 Petr Janda 2020-05-04 14:08:16 UTC
with test build most errors disappeared (I did'n check if it works correctly though)
But I've foud one which prints error. I don't know how to fix it

# grubby --update-kernel=$KERNEL --args="some\/escaped\/slashes"
sed: -e expression #1, char 35: unknown option to `s'
sed: -e expression #1, char 30: unknown option to `s'

grubby --update-kernel=$KERNEL --args="\1"
sed: -e expression #1, char 30: invalid reference \1 on `s' command's RHS

using sed looks pretty fragile - but the attached build probably fixed Oliver's issue

Comment 7 Javier Martinez Canillas 2020-05-04 14:25:36 UTC
(In reply to Petr Janda from comment #6)
> with test build most errors disappeared (I did'n check if it works correctly
> though)
> But I've foud one which prints error. I don't know how to fix it
> 
> # grubby --update-kernel=$KERNEL --args="some\/escaped\/slashes"
> sed: -e expression #1, char 35: unknown option to `s'
> sed: -e expression #1, char 30: unknown option to `s'
> 
> grubby --update-kernel=$KERNEL --args="\1"
> sed: -e expression #1, char 30: invalid reference \1 on `s' command's RHS
>
> using sed looks pretty fragile - but the attached build probably fixed
> Oliver's issue

Agreed, this has gotten complex enough that needs to be written in a proper language.

Yes, the attached test package should contain fixes for Oliver's issue and also the first issue that you described.

Comment 15 errata-xmlrpc 2020-11-04 01:51:12 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 (grubby bug fix and enhancement update), 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-2020:4502


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