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 - /etc/cron.daily/rhsmd evaluates non-zero string incorrectly
Summary: /etc/cron.daily/rhsmd evaluates non-zero string incorrectly
Keywords:
Status: CLOSED DUPLICATE of bug 1823780
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.8
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-16 18:15 UTC by matthew.f.ludwig
Modified: 2020-04-24 14:47 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-24 14:47:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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 ***


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