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 1067686

Summary: RHBA-2014:0190 introduced a bug in status function which causes wrong status on package update
Product: Red Hat Enterprise Linux 6 Reporter: Tuomo Soini <tis>
Component: initscriptsAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED ERRATA QA Contact: Jan Ščotka <jscotka>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.5CC: kbsingh, nparmar, psklenar, redhat-bugzilla, rhbugs, toracat
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: initscripts-9.03.41-1.el6 Doc Type: Bug Fix
Doc Text:
-b option for status function in /etc/initd/functions returned wrong value, when checked binary was replaced during update.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 06:28:07 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:
Bug Depends On:    
Bug Blocks: 1067696    
Attachments:
Description Flags
proposed patch to work around package upate problem with status -b option
none
alternate patch which also fixes the issue but doesn't break any functionality none

Description Tuomo Soini 2014-02-20 21:00:20 UTC
Created attachment 865686 [details]
proposed patch to work around package upate problem with status -b option

Description of problem:

new -b /path/to/binary option for status fail to give correct status info on package update.

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

initscripts-9.03.40-2.el6_5.1
postfix-2.6.6-6.el6_5
rpm-4.8.0-37.el6

How reproducible:

Always.

Steps to Reproduce:
1. yum -y update
2. service postfix status

Actual results:
master dead but pid file exists

# lsof | grep master | grep delete
master    27440      root  txt       REG              253,0    171376   10229351 /usr/libexec/postfix/master (deleted)

# cat /var/spool/postfix/pid/master.pid
27440

Expected results:

New postfix running.

There are actually two bugs causing old postfix to run after package update.

But this status info actually shows what's wrong in status function when -b /path/to/binary is used and running binary has already been removed from filesystem.

Note: my patch is very simple, there is another way to fix this same issue in __readlink function by checking if there is match in ls -lb output for the binary name instaed of using $NF which prints "(delted)" in case of deleted binary.

Comment 2 Tuomo Soini 2014-02-20 22:01:18 UTC
Created attachment 865709 [details]
alternate patch which also fixes the issue but doesn't break any functionality

This patch uses real readlink binary from coreutils (which is already required by initscripts).

Comment 3 Lukáš Nykrýn 2014-02-21 08:49:24 UTC
Thanks for reporting this.
I would not use awk in this this case, since it does not work well will whitespaces.

[root@notas ~]$ /tmp/space\ sleep 50 &
[1] 6938
[root@notas ~]$ readlink /proc/6938/exe | awk '{ print $1 }'
/tmp/space
[root@notas ~]$ readlink /proc/6938/exe | sed -e 's/.*\s*(deleted)//'
/tmp/space sleep

Comment 4 Tuomo Soini 2014-02-24 06:27:41 UTC
That sed won't work because it maches whole string and not just the end.

$ readlink /proc/6063/exe
/usr/libexec/postfix/master (deleted)


$ readlink /proc/6063/exe | sed -e 's/.*\s*(deleted)//'

$

This sed would work:

$ readlink /proc/6063/exe | sed -e 's/\s*(deleted)//'
/usr/libexec/postfix/master

Even pure sh alternative would work for this case:

b=$(readlink /proc/6938/exe)
b=${b% (deleted)}
echo $b
/usr/libexec/postfix/master

Comment 5 Tuomo Soini 2014-02-24 06:35:17 UTC
(In reply to Tuomo Soini from comment #4)

> $ readlink /proc/6063/exe | sed -e 's/\s*(deleted)//'
> /usr/libexec/postfix/master

Not good. Should match only end of the string like my pure shell will do.

This is correct sed:

sed -e 's/\s*(deleted)$//'

Comment 6 Lukáš Nykrýn 2014-02-26 12:19:09 UTC
Yep, that should be correct.

Comment 11 errata-xmlrpc 2014-10-14 06:28:07 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, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1448.html