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 1845715 - boom: fix --add/del-opts and options precedence for edit and clone
Summary: boom: fix --add/del-opts and options precedence for edit and clone
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: boom-boot
Version: 8.3
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Bryn M. Reeves
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-09 21:18 UTC by Bryn M. Reeves
Modified: 2021-09-06 15:25 UTC (History)
7 users (show)

Fixed In Version: boom-boot-1.2-2.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 01:57:39 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4532 0 None None None 2020-11-04 01:57:48 UTC

Description Bryn M. Reeves 2020-06-09 21:18:07 UTC
Description of problem:
There are two bugs affecting the --add-opts and --del-opts options when used with the "boom edit" and "boom clone" commands in boom-1.2 that can cause the value of the command line arguments to be ignored.

The edit command ignores the command line arguments and the strategy used to merge the options changes from the command line and the existing boot entry is too simplistic: this leads to confusing behaviour when cloning a boot entry with a previous modification that conflicts with the current command line. For example cloning an entry with --add-opts "rhgb quiet" that was created with --del-opts "rhgb quiet". In this case the command line --add-opts should be effective as it should have higher precedence than the setting in the existing boot entry. In boom 1.0-1.2 the precedence is reversed and the --add-opts given to the clone command is effectively ignored.

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

How reproducible:
100%

Steps to Reproduce:
1. Create an entry for the test with "rhgb quiet" deleted:
# boom create --title adddeltest --rootlv rhel/root --del-opts "rhgb quiet"
Created entry with boot_id fc12426:
  title adddeltest
  machine-id b49e623f993c4fd7b200c5e350f9cacc
  version 4.18.0-167.el8.x86_64
  linux /vmlinuz-4.18.0-167.el8.x86_64
  initrd /initramfs-4.18.0-167.el8.x86_64.img
  options root=/dev/rhel/root ro rd.lvm.lv=rhel/root
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel

2. Edit or clone the entry to restore "rhgb quiet"
# boom clone fc12426 --add-opts "rhgb quiet"

3.

Actual results:
# boom clone fc12426 --add-opts "rhgb quiet"
Entry already exists (boot_id=fc12426).

(i.e. the entry created abvoe without "rhgb quiet")

Expected results:
# boom clone fc12426 --add-opts "rhgb quiet"
Cloned entry with boot_id fc12426 as boot_id 349f394:
  title adddeltest
  machine-id b49e623f993c4fd7b200c5e350f9cacc
  version 4.18.0-167.el8.x86_64
  linux /vmlinuz-4.18.0-167.el8.x86_64
  initrd /initramfs-4.18.0-167.el8.x86_64.img
  options root=/dev/rhel/root ro rd.lvm.lv=rhel/root rhgb quiet
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel

Additional info:
commit 9fb8f4e81078babda6c7407617e9e90e6c7fcaa5
Author: Bryn M. Reeves <bmr>
Date:   Tue Jun 9 21:46:21 2020 +0100

    boom: pass --add,del-opts to edit_entry() in edit command handler
    
    Signed-off-by: Bryn M. Reeves <bmr>

commit b6ab1091df02c5f694c88b903d72b557ff1d9b33
Author: Bryn M. Reeves <bmr>
Date:   Tue Jun 9 21:16:15 2020 +0100

    boom: fix precedence and handle conflicts when merging options
    
    The --add-opts and --del-opts options specify lists of options to
    add or remove from the default set when creating, editing or
    cloning a boot entry.
    
    When editing or cloning the command line values should be merged
    with the existing values in the BootEntry's attached BootParams:
    command line values should override any changes present in the
    original entry (so a --del-opt cancels a prior --add-opts and
    vice versa).
    
    Signed-off-by: Bryn M. Reeves <bmr>

Comment 1 Bryn M. Reeves 2020-06-10 16:01:34 UTC
The precedence bug is quite subtle and relies on the original boot entry being in a specific state (having been created with --add/del-opts) so I've added some extra test cases to check specifically for this behaviour. The two cases are mirror images of one another: the first checks that when an entry created with --add-opts is modified by a subsequent --del-opts, that the --del-opts takes effect, and the second the reverse. The first of these tests is the case that was broken in 1.2: the reverse case was correct, but the test is added to check for any future regression.

  test_clone_entry_del_opts_and_re_add
  test_clone_entry_add_opts_and_re_del

boom-1.2:

test_clone_entry_add_opts_and_re_del (tests.command_tests.CommandTests) ... ok
test_clone_entry_del_opts_and_re_add (tests.command_tests.CommandTests) ... FAIL

======================================================================
FAIL: test_clone_entry_del_opts_and_re_add (tests.command_tests.CommandTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/breeves/src/git/boom/tests/command_tests.py", line 538, in test_clone_entry_del_opts_and_re_add
    self.assertTrue("rhgb quiet" in be2.options)
AssertionError: False is not true

current master:
test_clone_entry_add_opts_and_re_del (tests.command_tests.CommandTests) ... ok
test_clone_entry_del_opts_and_re_add (tests.command_tests.CommandTests) ... ok

Comment 6 Juraj Hrdlica 2020-09-21 12:57:21 UTC
Verified with rpm:
boom-boot-1.2-2.el8.noarch

Cloning:

# boom create --title adddeltest --rootlv rhel_virt-262/root --del-opts "rhgb quiet"
Created entry with boot_id adcd0ad:
  title adddeltest
  machine-id 1a008e1b09fa4890b3ac1f526b88500f
  version 4.18.0-236.el8.x86_64
  linux /vmlinuz-4.18.0-236.el8.x86_64
  initrd /initramfs-4.18.0-236.el8.x86_64.img
  options root=/dev/rhel_virt-262/root ro rd.lvm.lv=rhel_virt-262/root
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel

# boom clone adcd0ad --add-opts "rhgb quiet"
Cloned entry with boot_id adcd0ad as boot_id 41339f2:
  title adddeltest
  machine-id 1a008e1b09fa4890b3ac1f526b88500f
  version 4.18.0-236.el8.x86_64
  linux /vmlinuz-4.18.0-236.el8.x86_64
  initrd /initramfs-4.18.0-236.el8.x86_64.img
  options root=/dev/rhel_virt-262/root ro rd.lvm.lv=rhel_virt-262/root rhgb quiet
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel

--------------------------------------------------------------------------------------
Editing:

boom create --title edittest --rootlv rhel_virt-262/root --del-opts "rhgb quiet"
Created entry with boot_id 64c9c2c:
  title edittest
  machine-id 1a008e1b09fa4890b3ac1f526b88500f
  version 4.18.0-236.el8.x86_64
  linux /vmlinuz-4.18.0-236.el8.x86_64
  initrd /initramfs-4.18.0-236.el8.x86_64.img
  options root=/dev/rhel_virt-262/root ro rd.lvm.lv=rhel_virt-262/root
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel

# boom edit 64c9c2c --add-opts "rhgb quiet"
Edited entry, boot_id now: 71d40dc
  title edittest
  machine-id 1a008e1b09fa4890b3ac1f526b88500f
  version 4.18.0-236.el8.x86_64
  linux /vmlinuz-4.18.0-236.el8.x86_64
  initrd /initramfs-4.18.0-236.el8.x86_64.img
  options root=/dev/rhel_virt-262/root ro rd.lvm.lv=rhel_virt-262/root rhgb quiet
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel

Comment 9 errata-xmlrpc 2020-11-04 01:57:39 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 (boom-boot 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:4532


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