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 1824961

Summary: /etc/cron.daily/rhsmd evaluates non-zero string incorrectly
Product: Red Hat Enterprise Linux 7 Reporter: matthew.f.ludwig
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED DUPLICATE QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.8CC: dmilhuisen, redakkan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-24 14:47:23 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 matthew.f.ludwig 2020-04-16 18:15:49 UTC
Description of problem:
After performing updates to a RH7 system, an error occurs when /etc/cron.daily/rhsmd runs.  The test for a string of non-zero length is evaluating to true, but no variable is returned from the grep statement.  It should perform the alternate statement, setting rhsmd_timeout=300.  Instead, it attempts to run a sleep command with no operand and fails.  The rhsm.conf.rpmnew file was created, but e use a modified rhsm.conf file for a proxy.

Below is output of error message:

Date: Thu, 16 Apr 2020 03:44:24 +0000 (GMT)

/etc/cron.daily/rhsmd:

sleep: missing operand
Try 'sleep --help' for more information.
/etc/cron.daily/rhsmd: line 19: 32461 Terminated              /usr/libexec/rhsmd -s

Below is the contents of the rhsmd script:

config=$(grep -E "^processTimeout" /etc/rhsm/rhsm.conf | grep -Po "[0-9]+")
if [ -n $config ]; then
  rhsmd_timeout=$config
else
  rhsmd_timeout=300
fi

/usr/libexec/rhsmd -s &
sleep $rhsmd_timeout;

ps_check=$(pgrep -f '/usr/libexec/rhsmd')
if [ -n "$ps_check" ]; then
  pkill -f '/usr/libexec/rhsmd' >/dev/null 2>&1
  logger -t rhsmd -p user.warn "rhsmd process exceeded runtime and was killed." >/dev/null 2>&1
fi

If the string being tested were enclosed in quotation marks, it would evaluate correctly.

config=$(grep -E "^processTimeout" /etc/rhsm/rhsm.conf | grep -Po "[0-9]+")
if [ -n "$config" ]; then
  rhsmd_timeout=$config
else
  rhsmd_timeout=300
fi

/usr/libexec/rhsmd -s &
sleep $rhsmd_timeout;

ps_check=$(pgrep -f '/usr/libexec/rhsmd')
if [ -n "$ps_check" ]; then
  pkill -f '/usr/libexec/rhsmd' >/dev/null 2>&1
  logger -t rhsmd -p user.warn "rhsmd process exceeded runtime and was killed." >/dev/null 2>&1
fi


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


How reproducible:
Always

Steps to Reproduce:
1. Execute /etc/cron.daily/rhsmd
2.
3.

Actual results:
sleep: missing operand

Expected results:
execute rhsmd -s


Additional info:

Comment 2 Rehana 2020-04-24 14:47:23 UTC

*** This bug has been marked as a duplicate of bug 1823780 ***