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.
Descriptionwilliam.nardone
2022-10-03 21:07:35 UTC
Description of problem:
We have a block of code that processes a hash with a date key in "01/Jul/2022" format. When we try to loop through the sorted keys with a sort procedure, we get an error indicating that the parameter passed to the convert_month routine is not a string. See the code below for a complete description.
hits hash
"01/Jul/2022" Title1 4
"03/Jul/2022" Title2 7
. . .
foreach $date (sort sortdate keys %hits){
. . .
}
sub sortdate(){
#parse the date format DD/MMM/YYYY - i.e. 07/Feb/2019
# into sortable key YYYY##DD - i.e. 20190207
{ substr($a,7,4) <=> substr($b,7,4) ||
Decode_Month(substr($a,3,3)) <=> Decode_Month(substr($b,3,3)) ||
substr($a,0,2) <=> substr($b,0,2)
}
}
When we run this, we get the following error:
Date::Calc::Decode_Month(): argument is not a string at ./xxx.pl line ###. Which points to the line with the Decode_Month(substr($a,3,3))
I can work around the error by forcing the result of the substr() call to be a string. Decode_Month("".substr($a,3,3)), but the type should have been set correctly without that, since substr returns the 3 character month string: Jan, Feb, ...
I put in extra debug prints and all of the keys in the hits array are valid date strings with a valid 3 char month abbreviation.
This code was ported over from Solaris and it is working fine there.
Version-Release number of selected component (if applicable): Date::Calc (6.4)
How reproducible:
Every time
Steps to Reproduce:
1. See above code
2.
3.
Actual results:
Error message: Date::Calc::Decode_Month(): argument is not a string at ./xxx.pl line ###.
Expected results:
process sorted list of hash elements
Additional info:
Thank you for the report. However, if you want Red Hat to fix it, you have to file an official support request at <https://access.redhat.com/support/>.
Bugzilla is not a support tool.
Could you please provide a small script that can be used as a reproducer?
I am not able to reproduce it with this script:
https://jplesnik.fedorapeople.org/bugzillas/bz2131834.pl
Description of problem: We have a block of code that processes a hash with a date key in "01/Jul/2022" format. When we try to loop through the sorted keys with a sort procedure, we get an error indicating that the parameter passed to the convert_month routine is not a string. See the code below for a complete description. hits hash "01/Jul/2022" Title1 4 "03/Jul/2022" Title2 7 . . . foreach $date (sort sortdate keys %hits){ . . . } sub sortdate(){ #parse the date format DD/MMM/YYYY - i.e. 07/Feb/2019 # into sortable key YYYY##DD - i.e. 20190207 { substr($a,7,4) <=> substr($b,7,4) || Decode_Month(substr($a,3,3)) <=> Decode_Month(substr($b,3,3)) || substr($a,0,2) <=> substr($b,0,2) } } When we run this, we get the following error: Date::Calc::Decode_Month(): argument is not a string at ./xxx.pl line ###. Which points to the line with the Decode_Month(substr($a,3,3)) I can work around the error by forcing the result of the substr() call to be a string. Decode_Month("".substr($a,3,3)), but the type should have been set correctly without that, since substr returns the 3 character month string: Jan, Feb, ... I put in extra debug prints and all of the keys in the hits array are valid date strings with a valid 3 char month abbreviation. This code was ported over from Solaris and it is working fine there. Version-Release number of selected component (if applicable): Date::Calc (6.4) How reproducible: Every time Steps to Reproduce: 1. See above code 2. 3. Actual results: Error message: Date::Calc::Decode_Month(): argument is not a string at ./xxx.pl line ###. Expected results: process sorted list of hash elements Additional info: