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 1840871 - boom.cache.load_cache() warning branch references undefined variable
Summary: boom.cache.load_cache() warning branch references undefined variable
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
low
Target Milestone: rc
: 8.0
Assignee: LVM and device-mapper development team
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-27 18:43 UTC by Bryn M. Reeves
Modified: 2021-09-06 15:24 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-05-27 18:43:43 UTC
Description of problem:
Coverity identified a problem in a load_cache() warning branch when a specific type of inconsistency is found in the cache metadata: the "images" variable used to report the error is incorrect and should be "image_id":


commit d788f82746826d091abcdf76b5f4884c22e3b7de
Author: Bryn M. Reeves <bmr>
Date:   Wed May 20 15:14:27 2020 +0100

    boom.cache: use correct variable in load_cache() warning branch
    
    Signed-off-by: Bryn M. Reeves <bmr>

diff --git a/boom/cache.py b/boom/cache.py
index 1dc5e07..cf7de47 100644
--- a/boom/cache.py
+++ b/boom/cache.py
@@ -238,7 +238,7 @@ def load_cache(verify=True, digests=False):
     images = cachedata["images"]
     for image_id in images.keys():
         if image_id not in ids:
-            _log_warn("Found orphan image_id '%s'" % image)
+            _log_warn("Found orphan image_id '%s'" % image_id)
             # clean up?
 
     _log_debug("Loaded %d cache paths and %d images" %


Version-Release number of selected component (if applicable):
1.1-1.el8

How reproducible:
100%

Steps to Reproduce:
1. Create at least one cache entry by using 'boom create --backup'
2. Use "boom cache list" to identify any image_id, e.g.:

# boom cache list
Path                                   ImageID Timestamp  State   
/vmlinuz-4.16.11-100.fc26.x86_64       0c703b0 1588366186 CACHED  
/vmlinuz-3.10.1-1.el7                  ee3e6f8 1588366186 CACHED  
/initramfs-3.10.1-1.el7.img            0f61425 1588366186 RESTORED
/initramfs-4.16.11-100.fc26.x86_64.img 77dc54e 1588366186 CACHED
  
3. Delete the cache image file for the corresponding image_id:

# rm /boot/boom/cache/0c703b0*.img

4. Run "boom cache list" (or any command that loads the boom cache)

Actual results:
$ boom cache list
WARNING - Image identifier '0c703b03017edda8296b2208f3742e90d0494b76' not found in cache
ERROR - Command failed: global name 'image' is not defined
WARNING - Image identifier '0c703b03017edda8296b2208f3742e90d0494b76' not found in cache
ERROR - Could not clean boot image cache: global name 'image' is not defined

$ boom cache list --debug=all
WARNING - Image identifier '0c703b03017edda8296b2208f3742e90d0494b76' not found in cache
Traceback (most recent call last):
  File "/home/breeves/src/git/boom/bin/boom", line 7, in <module>
    r = main(sys.argv)
  File "/home/breeves/src/git/boom/boom/command.py", line 3231, in main
    status = command[1](cmd_args, select, opts, identifier)
  File "/home/breeves/src/git/boom/boom/command.py", line 2804, in _list_cache_cmd
    print_fn)
  File "/home/breeves/src/git/boom/boom/command.py", line 2154, in _generic_list_cmd
    expand=cmd_args.expand_variables)
  File "/home/breeves/src/git/boom/boom/command.py", line 1776, in print_cache
    output_fields=output_fields, sort_keys=sort_keys)
  File "/home/breeves/src/git/boom/boom/command.py", line 1752, in _print_cache
    ces = find_fn(selection=selection)
  File "/home/breeves/src/git/boom/boom/cache.py", line 718, in find_cache_paths
    matches = _find_cache_entries(selection=selection, images=False)
  File "/home/breeves/src/git/boom/boom/cache.py", line 672, in _find_cache_entries
    load_cache()
  File "/home/breeves/src/git/boom/boom/cache.py", line 241, in load_cache
    _log_warn("Found orphan image_id '%s'" % image)
NameError: global name 'image' is not defined

Expected results:
$ boom cache list
WARNING - Image identifier '0c703b03017edda8296b2208f3742e90d0494b76' not found in cache
WARNING - Found orphan image_id '0c703b03017edda8296b2208f3742e90d0494b76'
Path                                   ImageID Timestamp  State   
/vmlinuz-4.16.11-100.fc26.x86_64       0c703b0 1588366186 BROKEN  
/vmlinuz-3.10.1-1.el7                  ee3e6f8 1588366186 CACHED  
/initramfs-3.10.1-1.el7.img            0f61425 1588366186 RESTORED
/initramfs-4.16.11-100.fc26.x86_64.img 77dc54e 1588366186 CACHED  

Additional info:

Comment 1 Bryn M. Reeves 2020-06-24 14:50:58 UTC
Fixed upstream in boom-1.2.

Comment 5 Roman Bednář 2020-09-16 10:07:12 UTC
Verified. Cache metadata inconsistencies are now listed properly. Also the warning message changed slightly due to this commit: 

https://github.com/snapshotmanager/boom/commit/b3c0d8b209ae7615261a39abcb25bfc1c03239c2#diff-5ac18ce178c550b92c53d871eed288f1L241


# boom create --backup --root-lv rhel_virt-030/root
WARNING - Boom grub2 integration is disabled in '/boot/../etc/default/boom'
Created entry with boot_id 15dbae7:
  title Red Hat Enterprise Linux 8 (4.18.0-236.el8.x86_64)
  machine-id 77302920920a40c8bb6e0a28d727fd54
  version 4.18.0-236.el8.x86_64
  linux /vmlinuz-4.18.0-236.el8.x86_64.boom0
  initrd /initramfs-4.18.0-236.el8.x86_64.img.boom0
  options root=/dev/rhel_virt-030/root ro rd.lvm.lv=rhel_virt-030/root rhgb quiet
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel

# boom cache list
Path                                       ImageID Timestamp  State
/initramfs-4.18.0-236.el8.x86_64.img.boom0 646a998 1600171069 RESTORED
/vmlinuz-4.18.0-236.el8.x86_64.boom0       dec192b 1599668800 RESTORED

# rm /boot/boom/cache/dec192bfb33317bae640a4f8b368c8138c736675.img
rm: remove regular file '/boot/boom/cache/dec192bfb33317bae640a4f8b368c8138c736675.img'? y

# boom cache list
WARNING - Image identifier 'dec192bfb33317bae640a4f8b368c8138c736675' not found in cache for path /vmlinuz-4.18.0-236.el8.x86_64.boom0
WARNING - Found unknown image_id 'dec192bfb33317bae640a4f8b368c8138c736675'
Path                                       ImageID Timestamp  State
/initramfs-4.18.0-236.el8.x86_64.img.boom0 646a998 1600171069 RESTORED
/vmlinuz-4.18.0-236.el8.x86_64.boom0       dec192b 1599668800 BROKEN

# boom cache list --debug=all
WARNING - Image identifier 'dec192bfb33317bae640a4f8b368c8138c736675' not found in cache for path /vmlinuz-4.18.0-236.el8.x86_64.boom0
WARNING - Found unknown image_id 'dec192bfb33317bae640a4f8b368c8138c736675'
Path                                       ImageID Timestamp  State
/initramfs-4.18.0-236.el8.x86_64.img.boom0 646a998 1600171069 RESTORED
/vmlinuz-4.18.0-236.el8.x86_64.boom0       dec192b 1599668800 BROKEN

# rpm -qa | grep boom
python3-boom-1.2-2.el8.noarch
boom-boot-1.2-2.el8.noarch
boom-boot-grub2-1.2-2.el8.noarch
boom-boot-conf-1.2-2.el8.noarch

Comment 8 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.