Red Hat Bugzilla – Bug 1067686
RHBA-2014:0190 introduced a bug in status function which causes wrong status on package update
Last modified: 2016-11-25 07:56:31 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.
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).
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
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
(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)$//'
Yep, that should be correct.
Patch committed to upstream rhel branch https://git.fedorahosted.org/cgit/initscripts.git/commit/?h=rhel6-branch&id=9f13c5e2cb4b2780f6137f83f87e2e12636718d0
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