NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/53458: usr.sbin/ypserv/ypinit: error while checking hostname



>Number:         53458
>Category:       bin
>Synopsis:       usr.sbin/ypserv/ypinit: error while checking hostname
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 18 06:10:00 +0000 2018
>Originator:     Frédéric Fauberteau
>Release:        NetBSD-current
>Organization:
>Environment:
NetBSD defiler.triaxx.org 8.0_RC2 NetBSD 8.0_RC2 (XEN3_DOM0) #0: Tue Jul 10 12:50:33 UTC 2018  triaxx%defiler.triaxx.org@localhost:/usr/obj/sys/arch/amd64/compile/XEN3_DOM0 amd64
>Description:
When I intend to create a master NIS server, I get the following error:
defiler.triaxx.org: not found                                                                                                                                                                                                                                                   
ypinit: The local host's hostname has not been set.                                                                                                                                                                                                                             
        Please set it with the hostname(1) command.

But the hostname is correctly set:
# grep hostname /etc/rc.conf                                                                                                                                                                                                                                             
hostname=defiler.triaxx.org
# hostname                                                                                                                                                                                                                                                               
defiler.triaxx.org

After inspecting /usr/sbin/ypinit, the line 98 sounds strange to me:
 97 # Check if hostname is set, don't accept an empty hostname
 98 host=`${HOSTNAME}`
 99 if [ -z "${host}" ]; then

The fix seems obvious but I prefer send this PR for validation since I never touch ypserv before.
>How-To-Repeat:
# ypinit -m
>Fix:
cvs diff: Diffing usr.sbin/ypserv/ypinit
Index: usr.sbin/ypserv/ypinit/ypinit.sh
===================================================================
RCS file: /cvsroot/src/usr.sbin/ypserv/ypinit/ypinit.sh,v
retrieving revision 1.12
diff -u -r1.12 ypinit.sh
--- usr.sbin/ypserv/ypinit/ypinit.sh	5 Oct 2004 11:35:35 -0000	1.12
+++ usr.sbin/ypserv/ypinit/ypinit.sh	18 Jul 2018 05:54:41 -0000
@@ -95,7 +95,7 @@
 fi
 
 # Check if hostname is set, don't accept an empty hostname
-host=`${HOSTNAME}`
+host=`echo ${HOSTNAME}`
 if [ -z "${host}" ]; then
 	cat 1>&2 << __no_hostname
 $progname: The local host's hostname has not been set.



Home | Main Index | Thread Index | Old Index