[RFC,v5,1/2] Remove --enable-obsolete-nsl

Message ID 20200630180340.62161-2-pvorel@suse.cz
State New
Headers show
Series
  • Remove --enable-obsolete-nsl --enable-obsolete-rpc
Related show

Commit Message

Petr Vorel June 30, 2020, 6:03 p.m.
this means that *always* libnsl is only built as shared library for
backward compatibility and the NSS modules libnss_nis and libnss_nisplus
are not built at all, libnsl's headers aren't installed.

This compatibility is kept only for architectures and ABIs that have
been added in or before version 2.28.

Replacement implementations based on TIRPC, which additionally support
IPv6, are available from <https://github.com/thkukuk/>.

This change does not affect libnss_compat which does not depended
on libnsl since 2.27 and thus can be used without NIS.

libnsl code depends on Sun RPC, e.g. on --enable-obsolete-rpc (installed
libnsl headers use installed Sun RPC headers), which will be removed in
the following commit.

Signed-off-by: Petr Vorel <pvorel@suse.cz>

---
changes v4->v5:
* update manual/nsswitch.texi and nss/nsswitch.conf
* mention that libnss_compat does not depended on libnsl since 2.27 and
  thus can be used without NIS
* wrap NEWS with column 72
* update commit message

 INSTALL                      |  9 -------
 NEWS                         | 11 ++++++++
 config.h.in                  |  4 ---
 config.make.in               |  1 -
 configure                    | 20 +-------------
 configure.ac                 | 11 --------
 grp/initgroups.c             |  8 +-----
 include/libc-symbols.h       |  9 +------
 manual/install.texi          | 10 -------
 manual/nss.texi              | 15 ++++-------
 manual/nsswitch.texi         | 16 +++++------
 nis/Makefile                 | 52 +-----------------------------------
 nscd/initgrcache.c           |  8 +-----
 nss/grp-lookup.c             |  6 +----
 nss/nsswitch.c               | 14 +++-------
 nss/nsswitch.conf            |  2 --
 nss/pwd-lookup.c             |  6 +----
 nss/spwd-lookup.c            |  6 +----
 scripts/build-many-glibcs.py |  6 ++---
 19 files changed, 37 insertions(+), 177 deletions(-)

-- 
2.27.0.rc0

Patch

diff --git a/INSTALL b/INSTALL
index 62e78725f5..3f5575e23e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -227,15 +227,6 @@  if 'CFLAGS' is specified it must enable optimization.  For example:
           colon-separated list in a single environment variable
           'GLIBC_TUNABLES'.
 
-'--enable-obsolete-nsl'
-     By default, libnsl is only built as shared library for backward
-     compatibility and the NSS modules libnss_compat, libnss_nis and
-     libnss_nisplus are not built at all.  Use this option to enable
-     libnsl with all depending NSS modules and header files.  For
-     architectures and ABIs that have been added after version 2.28 of
-     the GNU C Library this option is not available, and the libnsl
-     compatibility library is not built.
-
 '--disable-crypt'
      Do not install the passphrase-hashing library 'libcrypt' or the
      header file 'crypt.h'.  'unistd.h' will still declare the function
diff --git a/NEWS b/NEWS
index a660fc59a8..70be063526 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,17 @@  Major new features:
 
 Deprecated and removed features, and other changes affecting compatibility:
 
+* Remove configure option --enable-obsolete-nsl. libnsl is only built as
+  shared library for backward compatibility and the NSS modules
+  libnss_nis and libnss_nisplus are not built at all, libnsl's headers
+  aren't installed thus nsswitch.conf needs to be updated.  This
+  compatibility is kept only for architectures and ABIs that have been
+  added in or before version 2.28.  Replacement implementations based on
+  TI-RPC, which additionally support IPv6, are available from
+  <https://github.com/thkukuk/>.  This change does not affect
+  libnss_compat which does not depended on libnsl since 2.27 and thus
+  can be used without NIS.
+
 * The deprecated <sys/sysctl.h> header and the sysctl function have been
   removed.  To support old binaries, the sysctl function continues to
   exist as a compatibility symbol (on those architectures which had it),
diff --git a/config.h.in b/config.h.in
index 831eca2fe1..9eb71a81b7 100644
--- a/config.h.in
+++ b/config.h.in
@@ -161,10 +161,6 @@ 
    to link against.  */
 #undef LINK_OBSOLETE_RPC
 
-/* Define if obsolete libnsl code should be made available for user-level
-   code to link against.  */
-#undef LINK_OBSOLETE_NSL
-
 /* Define if Systemtap <sys/sdt.h> probes should be defined.  */
 #undef USE_STAP_PROBE
 
diff --git a/config.make.in b/config.make.in
index 2fed3da773..cefb6d4a90 100644
--- a/config.make.in
+++ b/config.make.in
@@ -97,7 +97,6 @@  build-static-nss = @static_nss@
 cross-compiling = @cross_compiling@
 force-install = @force_install@
 link-obsolete-rpc = @link_obsolete_rpc@
-build-obsolete-nsl = @build_obsolete_nsl@
 build-crypt = @build_crypt@
 build-nscd = @build_nscd@
 use-nscd = @use_nscd@
diff --git a/configure b/configure
index b8ef8c7a51..793c0068cc 100755
--- a/configure
+++ b/configure
@@ -673,7 +673,6 @@  base_machine
 have_tunables
 build_pt_chown
 build_nscd
-build_obsolete_nsl
 link_obsolete_rpc
 libc_cv_static_nss_crypt
 libc_cv_nss_crypt
@@ -786,7 +785,6 @@  enable_experimental_malloc
 enable_crypt
 enable_nss_crypt
 enable_obsolete_rpc
-enable_obsolete_nsl
 enable_systemtap
 enable_build_nscd
 enable_nscd
@@ -1459,8 +1457,6 @@  Optional Features:
   --enable-nss-crypt      enable libcrypt to use nss
   --enable-obsolete-rpc   build and install the obsolete RPC code for
                           link-time usage
-  --enable-obsolete-nsl   build and install the obsolete libnsl library and
-                          depending NSS modules
   --enable-systemtap      enable systemtap static probe points [default=no]
   --disable-build-nscd    disable building and installing the nscd daemon
   --disable-nscd          library functions will not contact the nscd daemon
@@ -3654,20 +3650,6 @@  if test "$link_obsolete_rpc" = yes; then
 
 fi
 
-# Check whether --enable-obsolete-nsl was given.
-if test "${enable_obsolete_nsl+set}" = set; then :
-  enableval=$enable_obsolete_nsl; build_obsolete_nsl=$enableval
-else
-  build_obsolete_nsl=no
-fi
-
-
-
-if test "$build_obsolete_nsl" = yes; then
-  $as_echo "#define LINK_OBSOLETE_NSL 1" >>confdefs.h
-
-fi
-
 # Check whether --enable-systemtap was given.
 if test "${enable_systemtap+set}" = set; then :
   enableval=$enable_systemtap; systemtap=$enableval
@@ -3785,7 +3767,7 @@  main ()
 {
 
 #ifndef __CET__
-#error no CET compiler support
+# error no CET compiler support
 #endif
   ;
   return 0;
diff --git a/configure.ac b/configure.ac
index ff00591fd4..33a1189804 100644
--- a/configure.ac
+++ b/configure.ac
@@ -387,17 +387,6 @@  if test "$link_obsolete_rpc" = yes; then
   AC_DEFINE(LINK_OBSOLETE_RPC)
 fi
 
-AC_ARG_ENABLE([obsolete-nsl],
-              AC_HELP_STRING([--enable-obsolete-nsl],
-                             [build and install the obsolete libnsl library and depending NSS modules]),
-              [build_obsolete_nsl=$enableval],
-              [build_obsolete_nsl=no])
-AC_SUBST(build_obsolete_nsl)
-
-if test "$build_obsolete_nsl" = yes; then
-  AC_DEFINE(LINK_OBSOLETE_NSL)
-fi
-
 AC_ARG_ENABLE([systemtap],
               [AS_HELP_STRING([--enable-systemtap],
 	       [enable systemtap static probe points @<:@default=no@:>@])],
diff --git a/grp/initgroups.c b/grp/initgroups.c
index f4c4e986e9..0c17141117 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -31,12 +31,6 @@ 
 #include "../nscd/nscd-client.h"
 #include "../nscd/nscd_proto.h"
 
-#ifdef LINK_OBSOLETE_NSL
-# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
-#else
-# define DEFAULT_CONFIG "files"
-#endif
-
 /* Type of the lookup function.  */
 typedef enum nss_status (*initgroups_dyn_function) (const char *, gid_t,
 						    long int *, long int *,
@@ -83,7 +77,7 @@  internal_getgrouplist (const char *user, gid_t group, long int *size,
 				  &__nss_initgroups_database) < 0)
 	{
 	  if (__nss_group_database == NULL)
-	    no_more = __nss_database_lookup2 ("group", NULL, DEFAULT_CONFIG,
+	    no_more = __nss_database_lookup2 ("group", NULL, "files",
 					      &__nss_group_database);
 
 	  __nss_initgroups_database = __nss_group_database;
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index b2f36bc44b..9b8a6f11ec 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -833,13 +833,7 @@  for linking")
 # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libnsl_hidden_tls_proto(name, attrs...) \
   hidden_tls_proto (name, ##attrs)
-# ifdef LINK_OBSOLETE_NSL
-   /* libnsl_hidden_nolink should only get used in libnsl code.  */
-#  define libnsl_hidden_nolink_def(name, version) libnsl_hidden_def (name)
-# else
-#  define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version)
-# endif
-# define libnsl_hidden_def(name) hidden_def (name)
+# define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version)
 # define libnsl_hidden_weak(name) hidden_weak (name)
 # define libnsl_hidden_ver(local, name) hidden_ver (local, name)
 # define libnsl_hidden_data_def(name) hidden_data_def (name)
@@ -849,7 +843,6 @@  for linking")
 #else
 # define libnsl_hidden_proto(name, attrs...)
 # define libnsl_hidden_tls_proto(name, attrs...)
-# define libnsl_hidden_def(name)
 # define libnsl_hidden_weak(name)
 # define libnsl_hidden_ver(local, name)
 # define libnsl_hidden_data_def(name)
diff --git a/manual/install.texi b/manual/install.texi
index c1e49a94fe..ea0059a4ec 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -257,16 +257,6 @@  This frontend allows users to specify tunables as a colon-separated list in a
 single environment variable @env{GLIBC_TUNABLES}.
 @end table
 
-@item --enable-obsolete-nsl
-By default, libnsl is only built as shared library for backward
-compatibility and the NSS modules libnss_compat, libnss_nis and
-libnss_nisplus are not built at all.
-Use this option to enable libnsl with all depending NSS modules and
-header files.
-For architectures and ABIs that have been added after version 2.28 of
-@theglibc{} this option is not available, and the libnsl compatibility
-library is not built.
-
 @item --disable-crypt
 Do not install the passphrase-hashing library @file{libcrypt} or the
 header file @file{crypt.h}.  @file{unistd.h} will still declare the
diff --git a/manual/nss.texi b/manual/nss.texi
index 821469a78a..80e730768e 100644
--- a/manual/nss.texi
+++ b/manual/nss.texi
@@ -328,17 +328,12 @@  For the @code{hosts} and @code{networks} databases the default value is
 the DNS service not to be available but if it is available the answer it
 returns is definitive.
 
-The @code{passwd}, @code{group}, and @code{shadow} databases are
+The @code{passwd}, @code{group}, and @code{shadow} databases was
 traditionally handled in a special way.  The appropriate files in the
-@file{/etc} directory are read but if an entry with a name starting
-with a @code{+} character is found NIS is used.  This kind of lookup
-remains possible if @theglibc{} was configured with the
-@code{--enable-obsolete-nsl} option and the special lookup service
-@code{compat} is used.  If @theglibc{} was configured with the
-@code{--enable-obsolete-nsl} option the default value for the three
-databases above is @code{compat [NOTFOUND=return] files}.  If the
-@code{--enable-obsolete-nsl} option was not used the default value
-for the services is @code{files}.
+@file{/etc} directory were read but if an entry with a name starting
+with a @code{+} character was found NIS was used.  This kind of lookup
+was removed and now the default value for the services is @code{files}.
+libnss_compat no longer depends on libnsl and can be used without NIS.
 
 For all other databases the default value is @code{files} unless
 @theglibc{} was configured with @code{--enable-obsolete-rpc} option, in
diff --git a/manual/nsswitch.texi b/manual/nsswitch.texi
index 62e7f607d1..a6ff3bed74 100644
--- a/manual/nsswitch.texi
+++ b/manual/nsswitch.texi
@@ -3,14 +3,14 @@ 
 # Name Service Switch configuration file.
 #
 
-passwd:     db files nis
+passwd:     db files
 shadow:     files
-group:      db files nis
+group:      db files
 
-hosts:      files nisplus nis dns
-networks:   nisplus [NOTFOUND=return] files
+hosts:      files dns
+networks:   files
 
-ethers:     nisplus [NOTFOUND=return] db files
-protocols:  nisplus [NOTFOUND=return] db files
-rpc:        nisplus [NOTFOUND=return] db files
-services:   nisplus [NOTFOUND=return] db files
+ethers:     db files
+protocols:  db files
+rpc:        db files
+services:   db files
diff --git a/nis/Makefile b/nis/Makefile
index 6ce2199459..8c6028a3ca 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -22,40 +22,13 @@  subdir	:= nis
 
 include ../Makeconfig
 
-ifndef have-GLIBC_2.28
-
-ifeq ($(build-obsolete-nsl),yes)
-$(error --enabe-obsolete-nsl is not available)
-endif
-
-else
-
-ifeq ($(build-obsolete-nsl),yes)
-headers			:= $(wildcard rpcsvc/*.[hx])
-
-# These are the databases available for the nis (and perhaps later nisplus)
-# service.  This must be a superset of the services in nss.
-databases		= proto service hosts network grp pwd rpc ethers \
-			  spwd netgrp alias publickey
-
-# Specify rules for the nss_* modules.
-services		:= nis nisplus
-endif
+ifdef have-GLIBC_2.28
 
 extra-libs		= libnsl
-ifeq ($(build-obsolete-nsl),yes)
-extra-libs += $(services:%=libnss_%)
-endif
 # These libraries will be built in the `others' pass rather than
 # the `lib' pass, because they depend on libc.so being built already.
 extra-libs-others	= $(extra-libs)
 
-ifeq ($(build-obsolete-nsl),yes)
-# The sources are found in the appropriate subdir.
-subdir-dirs = $(services:%=nss_%)
-vpath %.c $(subdir-dirs)
-endif
-
 libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
 		  nis_subr nis_local_names nis_free nis_file \
 		  nis_print nis_error nis_call nis_lookup\
@@ -68,17 +41,6 @@  libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
 		  nis_findserv nis_callback nis_clone_dir nis_clone_obj\
 		  nis_clone_res
 
-ifeq ($(build-obsolete-nsl),yes)
-libnsl-routines += nss-default
-libnss_nis-routines	:= $(addprefix nis-,$(databases)) nis-initgroups \
-			   nss-nis
-libnss_nis-inhibit-o	= $(filter-out .os,$(object-suffixes))
-
-libnss_nisplus-routines	:= $(addprefix nisplus-,$(databases)) nisplus-parser \
-			   nss-nisplus nisplus-initgroups
-libnss_nisplus-inhibit-o = $(filter-out .os,$(object-suffixes))
-
-else # not $(build-obsolete-nsl)
 # Pretend that libnsl.so is a linker script, so that the symbolic link
 # is not installed.
 install-lib-ldscripts = libnsl.so
@@ -86,19 +48,11 @@  $(inst_libdir)/libnsl.so:
 # Build only shared libnsl.
 libnsl-inhibit-o = $(filter-out .os,$(object-suffixes))
 
-endif # not $(build-obsolete-nsl)
-
 endif # have-GLIBC_2.28
 
 include ../Rules
 
 
-ifeq ($(build-obsolete-nsl),yes)
-$(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \
-			$(common-objpfx)nss/libnss_files.so
-$(objpfx)libnss_nisplus.so: $(objpfx)libnsl.so$(libnsl.so-version)
-endif
-
 libnsl-libc = $(common-objpfx)linkobj/libc.so
 # Target-specific variable setting to link objects using deprecated
 # RPC interfaces with the version of libc.so that makes them available
@@ -109,8 +63,4 @@  $(services:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
 
 ifeq ($(build-shared),yes)
 $(others:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
-else
-ifeq ($(build-obsolete-nsl),yes)
-$(others:%=$(objpfx)%): $(objpfx)libnsl.a
-endif
 endif
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index a9f230bfb0..a1102e4e46 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -32,12 +32,6 @@ 
 
 #include "../nss/nsswitch.h"
 
-#ifdef LINK_OBSOLETE_NSL
-# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
-#else
-# define DEFAULT_CONFIG "files"
-#endif
-
 /* Type of the lookup function.  */
 typedef enum nss_status (*initgroups_dyn_function) (const char *, gid_t,
 						    long int *, long int *,
@@ -88,7 +82,7 @@  addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
   int no_more;
 
   if (group_database == NULL)
-    no_more = __nss_database_lookup2 ("group", NULL, DEFAULT_CONFIG,
+    no_more = __nss_database_lookup2 ("group", NULL, "files",
 				      &group_database);
   else
     no_more = 0;
diff --git a/nss/grp-lookup.c b/nss/grp-lookup.c
index d147201b0a..f65da2089b 100644
--- a/nss/grp-lookup.c
+++ b/nss/grp-lookup.c
@@ -19,10 +19,6 @@ 
 #include <config.h>
 
 #define DATABASE_NAME group
-#ifdef LINK_OBSOLETE_NSL
-# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
-#else
-# define DEFAULT_CONFIG "files"
-#endif
+#define DEFAULT_CONFIG "files"
 
 #include "XXX-lookup.c"
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 319e22c3fc..8d7b69d4bc 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -42,14 +42,6 @@ 
 #include <sysdep.h>
 #include <config.h>
 
-#ifdef LINK_OBSOLETE_NSL
-# define DEFAULT_CONFIG    "compat [NOTFOUND=return] files"
-# define DEFAULT_DEFCONFIG "nis [NOTFOUND=return] files"
-#else
-# define DEFAULT_CONFIG    "files"
-# define DEFAULT_DEFCONFIG "files"
-#endif
-
 /* Prototypes for the local functions.  */
 static name_database *nss_parse_file (const char *fname);
 static name_database_entry *nss_getline (char *line);
@@ -161,7 +153,7 @@  __nss_database_lookup2 (const char *database, const char *alternate_name,
      or null to use the most common default.  */
   if (*ni == NULL)
     {
-      *ni = nss_parse_service_list (defconfig ?: DEFAULT_DEFCONFIG);
+      *ni = nss_parse_service_list (defconfig ?: "files");
       if (*ni != NULL)
 	{
 	  /* Record the memory we've just allocated in defconfig_entries list,
@@ -845,8 +837,8 @@  __nss_disable_nscd (void (*cb) (size_t, struct traced_file *))
   is_nscd = true;
 
   /* Find all the relevant modules so that the init functions are called.  */
-  nss_load_all_libraries ("passwd", DEFAULT_CONFIG);
-  nss_load_all_libraries ("group", DEFAULT_CONFIG);
+  nss_load_all_libraries ("passwd", "files");
+  nss_load_all_libraries ("group", "files");
   nss_load_all_libraries ("hosts", "dns [!UNAVAIL=return] files");
   nss_load_all_libraries ("services", NULL);
 
diff --git a/nss/nsswitch.conf b/nss/nsswitch.conf
index 4a6bcb1f7b..40030d1dd7 100644
--- a/nss/nsswitch.conf
+++ b/nss/nsswitch.conf
@@ -15,8 +15,6 @@ 
 #	dns			Use DNS (Domain Name Service)
 #	files			Use the local files in /etc
 #	hesiod			Use Hesiod (DNS) for user lookups
-#	nis			Use NIS (NIS version 2), also called YP
-#	nisplus			Use NIS+ (NIS version 3)
 #
 # See `info libc 'NSS Basics'` for more information.
 #
diff --git a/nss/pwd-lookup.c b/nss/pwd-lookup.c
index 401306785d..e15e150019 100644
--- a/nss/pwd-lookup.c
+++ b/nss/pwd-lookup.c
@@ -19,10 +19,6 @@ 
 #include <config.h>
 
 #define DATABASE_NAME passwd
-#ifdef LINK_OBSOLETE_NSL
-# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
-#else
-# define DEFAULT_CONFIG "files"
-#endif
+#define DEFAULT_CONFIG "files"
 
 #include "XXX-lookup.c"
diff --git a/nss/spwd-lookup.c b/nss/spwd-lookup.c
index c7ca74fa44..21ea0afe75 100644
--- a/nss/spwd-lookup.c
+++ b/nss/spwd-lookup.c
@@ -20,10 +20,6 @@ 
 
 #define DATABASE_NAME shadow
 #define ALTERNATE_NAME passwd
-#ifdef LINK_OBSOLETE_NSL
-# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
-#else
-# define DEFAULT_CONFIG "files"
-#endif
+#define DEFAULT_CONFIG "files"
 
 #include "XXX-lookup.c"
diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 8c72b9e571..f0e6753d27 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -396,8 +396,7 @@  class Context(object):
                         extra_glibcs=[{'variant': 'disable-multi-arch',
                                        'cfg': ['--disable-multi-arch']},
                                       {'variant': 'enable-obsolete',
-                                       'cfg': ['--enable-obsolete-rpc',
-                                               '--enable-obsolete-nsl']},
+                                       'cfg': ['--enable-obsolete-rpc']},
                                       {'variant': 'static-pie',
                                        'cfg': ['--enable-static-pie']},
                                       {'variant': 'x32-static-pie',
@@ -414,8 +413,7 @@  class Context(object):
                                       {'variant': 'enable-obsolete',
                                        'arch': 'i686',
                                        'ccopts': '-m32 -march=i686',
-                                       'cfg': ['--enable-obsolete-rpc',
-                                               '--enable-obsolete-nsl']},
+                                       'cfg': ['--enable-obsolete-rpc']},
                                       {'arch': 'i486',
                                        'ccopts': '-m32 -march=i486'},
                                       {'arch': 'i586',