Source: hostname Version: 3.15+nmu1 Tag: patch This update fixes the man page.
* Michael Meskes <mes...@debian.org> [2015-09-01 12:42:13 +0200]: > This patch removes usage of yp_get_default_domain, but still leaves it > referenced in the manpage. So you should change that documentation, too. > done. > That being said there does not seem to be a need to keep the program names > ypdomainname and nisdomainname if using your patch, other than backward > compatibility that is. But then there does not seem to be a huge difference > between these two and domainname anyway. :) > i did not remove those programs, scripts may rely on those names and they have slightly different output. if they are not needed that should be fixed in a separate patch i think.
diff -Nru hostname-3.15/Makefile hostname-3.15+nmu1/Makefile --- hostname-3.15/Makefile 2013-11-03 14:25:42.000000000 +0000 +++ hostname-3.15+nmu1/Makefile 2015-06-04 22:12:11.000000000 +0000 @@ -1,4 +1,4 @@ -CFLAGS+=-O2 -Wall +CFLAGS+=-O2 -Wall -D_GNU_SOURCE # uncomment the following line if you want to install to a different base dir. #BASEDIR=/mnt/test @@ -9,7 +9,7 @@ OBJS=hostname.o hostname: $(OBJS) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) -lnsl + $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) ln -fs hostname dnsdomainname ln -fs hostname domainname ln -fs hostname ypdomainname diff -Nru hostname-3.15/debian/changelog hostname-3.15+nmu1/debian/changelog --- hostname-3.15/debian/changelog 2013-11-03 14:41:12.000000000 +0000 +++ hostname-3.15+nmu1/debian/changelog 2015-06-04 22:44:17.000000000 +0000 @@ -1,3 +1,15 @@ +hostname (3.15+nmu1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fixes build on musl libc. + * Use _GNU_SOURCE feature test macro, instead of glibc internal __USE_GNU. + * Use getdomainname instead of yp_get_default_domain because it is more + widely available and avoids the -lnsl dependency. + * localnisdomain is kept, even though it should be the same as localdomain, + so the behaviour is not changed in case of an error. + + -- Szabolcs Nagy <n...@port70.net> Thu, 04 Jun 2015 22:13:09 +0000 + hostname (3.15) unstable; urgency=low * Applied patch to make it possible to install binaries and man pages into diff -Nru hostname-3.15/hostname.1 hostname-3.15+nmu1/hostname.1 --- hostname-3.15/hostname.1 2013-11-03 14:24:23.000000000 +0000 +++ hostname-3.15+nmu1/hostname.1 2015-09-06 11:05:05.000000000 +0000 @@ -70,7 +70,7 @@ and .BR nisdomainname use the -.BR yp_get_default_domain (3). +.BR getdomainname (2). .LP .B dnsdomainname will print the domain part of the FQDN (Fully Qualified Domain Name). The diff -Nru hostname-3.15/hostname.c hostname-3.15+nmu1/hostname.c --- hostname-3.15/hostname.c 2013-11-03 14:26:51.000000000 +0000 +++ hostname-3.15+nmu1/hostname.c 2015-06-05 22:38:54.000000000 +0000 @@ -37,13 +37,11 @@ #include <stdio.h> #include <unistd.h> #include <getopt.h> -#define __USE_GNU 1 #include <string.h> #include <netdb.h> #include <errno.h> #include <ctype.h> #include <err.h> -#include <rpcsvc/ypclnt.h> #define VERSION "3.15" @@ -52,20 +50,19 @@ char *progname; /* - * Return the name of the nis default domain. This is just a wrapper for - * yp_get_default_domain. If something goes wrong, program exits. + * Return the name of the nis default domain. Same as localdomain below, + * but reports failure for unset domain. */ char * localnisdomain() { - char *buf = 0; + /* The historical NIS limit is 1024, the limit on Linux is 64. */ + static char buf[1025]; int myerror = 0; - myerror = yp_get_default_domain(&buf); - - /* yp_get_default_domain failed, abort. */ - if (myerror) { - printf("%s: %s\n", progname, yperr_string(myerror)); + myerror = getdomainname(buf, sizeof buf); + if (myerror || strcmp(buf, "(none)") == 0) { + printf("%s: Local domain name not set\n", progname); exit (1); }