Bug 8755
| Summary: | initscripts-4.83-1.i386.rpm makes sendmail, etc. fail to start | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Raw Hide | Reporter: | dunwoody |
| Component: | initscripts | Assignee: | Bill Nottingham <notting> |
| Status: | CLOSED RAWHIDE | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 1.0 | CC: | h1k6zn2m, rvokal |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2000-01-24 05:19:39 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
dunwoody
2000-01-23 00:01:15 UTC
Yup, known bug, fixed in initscripts-4.84. I suppose the fix in initscripts-4.84 is functional, but it's not how I would
have fixed it. In fact, it's not how I *did* fix it :-).
I realize that you need to have the "for apid in $pidlist" code in daemon and
killproc because if you put it in pidofproc it's actually running in a
subprocess and therefore doesn't do the right thing (i.e., it keeps a pid in the
list which shouldn't be in the list). But this special-case code is gross and
doesn't fix the underlying problem that pidofproc is returning bogus
information.
Here's how I fixed it:
--- functions 2000/01/25 22:38:54 1.1
+++ functions 2000/01/25 23:47:20
@@ -12,6 +12,27 @@
# First set up a default search path.
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
+# Unfortunately, the "pidof -x" invocations below will find this
+# script if it has the same name as the process being checked or
+# killed. To avoid this, we want to give pidof a list of process IDs
+# to ignore. More unfortunately, this is not as simple as just
+# telling it to ignore our PID, because we may be in a subprocess of
+# the actual script, e.g., because of a shell function run inside
+# backquotes. Even more unfortunately, such a subprocess returns the
+# PID of the base process when $$ is evaluated, rather than returning
+# the PID of the subprocess, so there's no easy way to get the PIDs of
+# such subprocesses to exclude them. To surmount these obstacles, use
+# some awk magic to get all the PIDs in a chain from the current PID
+# back to $$.
+
+AWK_PROG='NR == 1 { self=$1 }
+{ parent[$1] = $2 }
+END { while (self != upto) { self=parent[self]; print "-o " self } }'
+
+exclude_pids () {
+ ps -A --format '%p %P' | awk "$AWK_PROG" upto=$$ /dev/pid -
+}
+
# Get a sane screen width
[ -z "$COLUMNS" ] && COLUMNS=80
@@ -170,7 +191,7 @@
fi
# Next try "pidof"
- pid=`pidof -x $1`
+ pid=$(pidof $(exclude_pids) -x $1)
if [ "$pid" != "" ] ; then
echo $pid
return 0
@@ -185,7 +206,7 @@
fi
# First try "pidof"
- pid=`pidof -x $1`
+ pid=`pidof $(exclude_pids) -x $1`
if [ "$pid" != "" ] ; then
echo "$1 (pid $pid) is running..."
return 0
|