Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1067686 - RHBA-2014:0190 introduced a bug in status function which causes wrong status on package update
RHBA-2014:0190 introduced a bug in status function which causes wrong status ...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: initscripts (Show other bugs)
6.5
x86_64 Linux
unspecified Severity high
: rc
: ---
Assigned To: Lukáš Nykrýn
Jan Ščotka
:
Depends On:
Blocks: 1067696
  Show dependency treegraph
 
Reported: 2014-02-20 16:00 EST by Tuomo Soini
Modified: 2016-11-25 07:56 EST (History)
6 users (show)

See Also:
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 02:28:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed patch to work around package upate problem with status -b option (585 bytes, patch)
2014-02-20 16:00 EST, Tuomo Soini
no flags Details | Diff
alternate patch which also fixes the issue but doesn't break any functionality (606 bytes, patch)
2014-02-20 17:01 EST, Tuomo Soini
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1448 normal SHIPPED_LIVE initscripts bug fix and enhancement update 2014-10-13 21:05:44 EDT

  None (edit)
Description Tuomo Soini 2014-02-20 16:00:20 EST
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 17:01:18 EST
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 03:49:24 EST
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 01:27:41 EST
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 01:35:17 EST
(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 07:19:09 EST
Yep, that should be correct.
Comment 11 errata-xmlrpc 2014-10-14 02:28:07 EDT
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

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