From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i686)
The /etc/rc.d/init.d/ypbind script has a flaw in that RETVAL may be used
before it is set, in the case where "ypwhich" immediately succeeds. The
body of the loop is never executed, so RETVAL is uninitialized. Also, there
is no "sleep" in the loop, which means that the script doesn't allow enough
time on a slow network.
Steps to Reproduce:
1. manually start and stop ypbind. cd to /etc/rc.d/init.d
2. ./ypbind stop ; ./ypbind start
Actual Results: sometimes ypbind finds the domain server, other times it
Here is a proposed patch to the startup script. I used an arithmetic loop
with ypwhich and the setting of RETVAL inside the loop. This fixes the
uninitialized variable. I also added a sleep to allow a little time
between checks. I also increased the number of tries to 9. Lastly, when
running ypwhich, I only send stderr to /dev/null. This way, one can see
the name of the domain server in the logs once the bind succeeds. You are
welcome to use some or all of this patch as you see fit.
--- /etc/rc.d/init.d/ypbind.orig Tue Apr 24 14:30:47 2001
+++ /etc/rc.d/init.d/ypbind Tue Apr 24 14:20:06 2001
@@ -40,12 +40,15 @@
if [ -n "$pid" ]; then
echo -n $"Listening for an NIS domain server."
- until ypwhich > /dev/null 2>&1 || [ "$times" = "3" ]
+ for (( times = 1; times < 9; times++ ))
+ ypwhich 2> /dev/null
+ if [ $RETVAL -eq 0 ]; then
+ sleep 2
echo -n "."
if [ $RETVAL -eq 0 ]; then
Confirmed, I have a bunch of machines exhibiting unreliable startup due to this
after upgrading to 7.1.
I am also having trouble with NIS binding after a fresh 7.1 install, the script
is what seems to be broke as starting ypbind -broadcast has no problem.
fixed in 1.7-7 and later, to be released as errata.
Sorry, but 1.7-7 does not fix the coding errors completely. It does add sleeps
in the ypwhich loop, but it still fails to track successful ypwhich attempts
correctly. The new code does:
until ypwhich > /dev/null 2>&1 || [ "$times" = "3" ]
echo -n "."
We're still not initialising RETVAL before the possible loop exit, and the
RETVAL assignment will always set it to false (the '||' will result of the [
$times -eq 10 ] test, and we'll only set RETVAL if that test fails). If the
first ypwhich fails then we can never set RETVAL to true subsequently, so we'll
The code supplied at the top of this bugzilla report does not have these
There were two 1.7-7's, you got the wrong one; I've rebuilt mine as 1.7-8 and it is
currently in QA for errata release.
*** Bug 44323 has been marked as a duplicate of this bug. ***
The change is incomplete. There are 3 problems:
1. It doesn't check if ypbind starts ok or not.
2. 5 sec wait is not enough for me. I need 20 secs.
3. $pid may be empty in "kill $pid".
I will submit a new patch.
Created attachment 21365 [details]
A new patch
*** Bug 44860 has been marked as a duplicate of this bug. ***
This should be fixed in ypbind 1.10-7, soon in a rawhide near you.