Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1977452

Summary: typo in string format change
Product: Red Hat Enterprise Linux 9 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: medium    
Version: 9.0CC: csnyder, ptoscano, redakkan, zpetrace
Target Milestone: betaKeywords: EasyFix, Triaged
Target Release: 9.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.29.21-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 15:58:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Sefler 2021-06-29 19:06:20 UTC
Description of problem:

Please review the following commit...
https://github.com/candlepin/subscription-manager/commit/736be69b63c949354f1fdd7e083e0b8df80d204f#diff-38fba870aa67ed6ecc4cde9d3c2ef7c4d23034bc5c0aecd7f7da93afd55810abR328
The double quotes were left off.  Expected {filename} to be surrounded by double quotes.

Please review the following commit...
https://github.com/candlepin/subscription-manager/commit/736be69b63c949354f1fdd7e083e0b8df80d204f#diff-a43554804f3aafbe7a74f9a0c6e0cd721488aa8ada89fd51856a66245073393cR282-R283
I suspect that the two lines will be joined with two space characters unlike the original string. 


Version-Release number of selected component (if applicable):
[root@kvm-05-guest06 ~]# rpm -q subscription-manager
subscription-manager-1.29.12-2.el9.x86_64
[root@kvm-05-guest06 ~]# rpm -q subscription-manager --changelog | grep ENT-2468
- ENT-2468: Use format strings with named arguments for translator context

Comment 1 Pino Toscano 2021-06-30 08:44:57 UTC
To be fair: the situation of quoting for paths and directories in messages is a mess.
Sometimes there are, sometimes there are not, sometimes a path is quoted while a nearby/close/related message is not.

Rather than fixing the two reported issues, I'd settle for a uniform style first, and apply it on all the messages at once.

Comment 3 Zdenek Petracek 2021-11-23 18:52:52 UTC
Pre-verification:

Commit 1: @jsefler has an automated test for this case, which passed + we reviewed the following code change:

  from          print(_('File "%s" exists. Use -f to force overwriting the file.') % e.filename)
    to          print(_('File {filename} exists. Use -f to force overwriting the file.').format(filename=e.filename)) 

--> PASSED

Commit 2: After discussion we just reviewed the following code change with @jsefler

  from          msgs.append(_("Please visit https://access.redhat.com/management/consumers/%s to view the profile details.") % identity.uuid)
    to          msgs.append(_("Please visit https://access.redhat.com/management/consumers/{identity_uuid} to view the "
                              " profile details.").format(identity_uuid=identity.uuid))

 --> PASSED

Comment 4 John Sefler 2021-11-23 20:55:35 UTC
(In reply to Zdenek Petracek from comment #3)
> Pre-verification:
using CI build:
[root@kvm-08-guest04 ~]# rpm -q subscription-manager
subscription-manager-1.29.21-1.git.15.4ce9da7.el9.x86_64

> 
> Commit 1: @jsefler has an automated test for this case, which passed + we reviewed the following code change:
> 
>   from          print(_('File "%s" exists. Use -f to force overwriting the file.') % e.filename)
>     to          print(_('File {filename} exists. Use -f to force overwriting the file.').format(filename=e.filename)) 
Correction:
      to 
[root@kvm-08-guest04 ~]# grep "Use -f to force overwriting" /usr/lib64/python3.9/site-packages/rct/manifest_commands.py
                print(_('File "{filename}" exists. Use -f to force overwriting the file.').format(filename=e.filename))

> 
> --> PASSED
> 
> Commit 2: After discussion we just reviewed the following code change with @jsefler
> 
>   from          msgs.append(_("Please visit https://access.redhat.com/management/consumers/%s to view the profile details.") % identity.uuid)
>     to          msgs.append(_("Please visit https://access.redhat.com/management/consumers/{identity_uuid} to view the "
>                               " profile details.").format(identity_uuid=identity.uuid))
Correction:
      These lines of code are no longer applicable in RHEL9 because they belonged to migrate.py provided by package subscription-manager-migration which has been dropped and were removed with main pull request https://github.com/candlepin/subscription-manager/pull/2742...
[root@kvm-08-guest04 ~]# rpm -q subscription-manager --changelog | grep "Drop RHN"
- Drop RHN migration (ptoscano)

> 
>  --> PASSED

Comment 5 John Sefler 2021-11-23 21:07:04 UTC
Here is an example demonstrating the double quoting fix using a sample manifest zip file...

[root@kvm-08-guest04 test-manifests]# rpm -q subscription-manager --changelog | grep 1977452
- 1977452: typo in string format change Add quotes to a {filename} and remove
[root@kvm-08-guest04 test-manifests]# 
[root@kvm-08-guest04 test-manifests]# rct dump-manifest manifest_MCT0370.zip --destination /tmp
The manifest has been dumped to the /tmp directory
[root@kvm-08-guest04 test-manifests]# rct dump-manifest manifest_MCT0370.zip --destination /tmp
File "/tmp/signature" exists. Use -f to force overwriting the file.
     ^^^^^^^^^^^^^^^^

Verified:Tested - double quotes are now being used to surround the filename in the messaging.

Comment 8 Rehana 2021-12-01 11:58:45 UTC
Verifying on : 

# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.29.21-1.el9

# rpm -q subscription-manager --changelog | grep 1977452
- 1977452: typo in string format change Add quotes to a {filename} and remove

# rct dump-manifest 51da16bd-1300-475d-922f-379e06c3231f_certificates.zip --destination /tmp
The manifest has been dumped to the /tmp directory
# rct dump-manifest 51da16bd-1300-475d-922f-379e06c3231f_certificates.zip --destination /tmp
File "/tmp/signature" exists. Use -f to force overwriting the file.

^^ notice the file name is now in quotes.

Comment 10 errata-xmlrpc 2022-05-17 15:58:13 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 (new packages: subscription-manager), 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-2022:3984