diff mbox

autofs: use libtirpc instead of internal C implementation

Message ID 20170321193213.GA18747@waldemar-brodkorb.de
State Superseded
Headers show

Commit Message

Waldemar Brodkorb March 21, 2017, 7:32 p.m. UTC
uClibc-ng plans to remove internal RPC implementation as it
is ipv4 only and can not be used for most important RPC software
rpcbind and nfs-utils.
musl does not implement RPC and GNU C library deprecated the
internal implementation a while ago.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
I am planning to send patches to convert existing packages
and remove the RPC internal toolchain stuff, before releasing
uClibc-ng without RPC. For a smooth migration.
---
 package/autofs/0004-libtirpc-via-pkgconfig.patch | 83 ++++++++++++++++++++++++
 package/autofs/Config.in                         |  7 +-
 package/autofs/autofs.mk                         |  3 +-
 3 files changed, 88 insertions(+), 5 deletions(-)
 create mode 100644 package/autofs/0004-libtirpc-via-pkgconfig.patch

Comments

Thomas Petazzoni March 21, 2017, 9:24 p.m. UTC | #1
Hello,

On Tue, 21 Mar 2017 20:32:13 +0100, Waldemar Brodkorb wrote:

> @@ -2,8 +2,8 @@ config BR2_PACKAGE_AUTOFS
>  	bool "autofs"
>  	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
>  	depends on BR2_USE_MMU
> -	depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC
>  	depends on !BR2_STATIC_LIBS # dlfcn
> +	select BR2_PACKAGE_LIBTIRPC

Why should we force people to use libtirpc ? What about instead:

	select BR2_PACKAGE_LIBTIRPC if !BR2_TOOLCHAIN_HAS_NATIVE_RPC

and adjust the .mk file accordingly.

Thanks!

Thomas
Waldemar Brodkorb March 22, 2017, 2:09 a.m. UTC | #2
Hi,
Thomas Petazzoni wrote,

> Hello,
> 
> On Tue, 21 Mar 2017 20:32:13 +0100, Waldemar Brodkorb wrote:
> 
> > @@ -2,8 +2,8 @@ config BR2_PACKAGE_AUTOFS
> >  	bool "autofs"
> >  	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
> >  	depends on BR2_USE_MMU
> > -	depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC
> >  	depends on !BR2_STATIC_LIBS # dlfcn
> > +	select BR2_PACKAGE_LIBTIRPC
> 
> Why should we force people to use libtirpc ? 

Because the internal RPC implementation is mostly useless and
getting removed?

> What about instead:
> 
> 	select BR2_PACKAGE_LIBTIRPC if !BR2_TOOLCHAIN_HAS_NATIVE_RPC
> 
> and adjust the .mk file accordingly.

The idea was to entirely remove BR2_TOOLCHAIN_HAS_NATIVE_RPC in
further patches. This would involve to disable deprecated RPC in
internal Glibc and uClibc-ng toolchains. 
I think RPC support in external toolchains will disappear when
GNU C library will finally remove the code.

best regards
 Waldemar
Thomas Petazzoni March 22, 2017, 7:59 a.m. UTC | #3
Hello,

On Wed, 22 Mar 2017 03:09:46 +0100, Waldemar Brodkorb wrote:

> > On Tue, 21 Mar 2017 20:32:13 +0100, Waldemar Brodkorb wrote:
> >   
> > > @@ -2,8 +2,8 @@ config BR2_PACKAGE_AUTOFS
> > >  	bool "autofs"
> > >  	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
> > >  	depends on BR2_USE_MMU
> > > -	depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC
> > >  	depends on !BR2_STATIC_LIBS # dlfcn
> > > +	select BR2_PACKAGE_LIBTIRPC  
> > 
> > Why should we force people to use libtirpc ?   
> 
> Because the internal RPC implementation is mostly useless and
> getting removed?

I don't quite agree. The one in glibc has been used for years
successfully, and is still useful. So even if uClibc decides to remove
its internal RPC implementation, I'd like to give people the option to
use the internal RPC implementation of glibc.

I agree RPC support in glibc will most likely disappear at some point
in the future, but we're not there yet. So for now, I'd prefer if we
just took the step of dropping RPC support in uClibc, and doing the
necessary changes in packages so that they all build/work fine with
libtirpc. That's anyway a very good preparation step to get rid of
internal RPC support entirely at some point in the future.

Thanks!

Thomas
Arnout Vandecappelle March 23, 2017, 9:53 p.m. UTC | #4
On 22-03-17 08:59, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 22 Mar 2017 03:09:46 +0100, Waldemar Brodkorb wrote:
> 
>>> On Tue, 21 Mar 2017 20:32:13 +0100, Waldemar Brodkorb wrote:
>>>   
>>>> @@ -2,8 +2,8 @@ config BR2_PACKAGE_AUTOFS
>>>>  	bool "autofs"
>>>>  	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
>>>>  	depends on BR2_USE_MMU
>>>> -	depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC
>>>>  	depends on !BR2_STATIC_LIBS # dlfcn
>>>> +	select BR2_PACKAGE_LIBTIRPC  
>>>
>>> Why should we force people to use libtirpc ?   
>>
>> Because the internal RPC implementation is mostly useless and
>> getting removed?
> 
> I don't quite agree. The one in glibc has been used for years
> successfully, and is still useful. So even if uClibc decides to remove
> its internal RPC implementation, I'd like to give people the option to
> use the internal RPC implementation of glibc.
> 
> I agree RPC support in glibc will most likely disappear at some point
> in the future, but we're not there yet. So for now, I'd prefer if we
> just took the step of dropping RPC support in uClibc, and doing the
> necessary changes in packages so that they all build/work fine with
> libtirpc. That's anyway a very good preparation step to get rid of
> internal RPC support entirely at some point in the future.

 Well, if glibc is the only one that is still going to provide native RPC, I
really don't think it's worth keeping support for it. It's not as if the 125KB
extra from libtirpc are really going to hurt someone who is using glibc, right?
And keeping the option of native RPC or libtirpc is probably going to make the
code more complicated.

 So I tend to agree with Waldemar's approach.

 Regards,
 Arnout
Yann E. MORIN March 26, 2017, 9:22 a.m. UTC | #5
All,

On 2017-03-23 22:53 +0100, Arnout Vandecappelle spake thusly:
> On 22-03-17 08:59, Thomas Petazzoni wrote:
> > Hello,
> > 
> > On Wed, 22 Mar 2017 03:09:46 +0100, Waldemar Brodkorb wrote:
> > 
> >>> On Tue, 21 Mar 2017 20:32:13 +0100, Waldemar Brodkorb wrote:
> >>>   
> >>>> @@ -2,8 +2,8 @@ config BR2_PACKAGE_AUTOFS
> >>>>  	bool "autofs"
> >>>>  	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
> >>>>  	depends on BR2_USE_MMU
> >>>> -	depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC
> >>>>  	depends on !BR2_STATIC_LIBS # dlfcn
> >>>> +	select BR2_PACKAGE_LIBTIRPC  
> >>>
> >>> Why should we force people to use libtirpc ?   
> >>
> >> Because the internal RPC implementation is mostly useless and
> >> getting removed?
> > 
> > I don't quite agree. The one in glibc has been used for years
> > successfully, and is still useful. So even if uClibc decides to remove
> > its internal RPC implementation, I'd like to give people the option to
> > use the internal RPC implementation of glibc.
> > 
> > I agree RPC support in glibc will most likely disappear at some point
> > in the future, but we're not there yet. So for now, I'd prefer if we
> > just took the step of dropping RPC support in uClibc, and doing the
> > necessary changes in packages so that they all build/work fine with
> > libtirpc. That's anyway a very good preparation step to get rid of
> > internal RPC support entirely at some point in the future.
> 
>  Well, if glibc is the only one that is still going to provide native RPC, I
> really don't think it's worth keeping support for it. It's not as if the 125KB
> extra from libtirpc are really going to hurt someone who is using glibc, right?
> And keeping the option of native RPC or libtirpc is probably going to make the
> code more complicated.
> 
>  So I tend to agree with Waldemar's approach.

I would say that I agree with Waldemar and Arnout.

Especially since the internal RPC implementation in glibc is not even
complete (not IPv6-clean for example) so it really makes sense to switch
to libtirpc which is nowadays pretty much stable.

Regards,
Yann E. MORIN.
Waldemar Brodkorb March 28, 2017, 5:47 p.m. UTC | #6
Hi,
Yann E. MORIN wrote,

> All,
> 
> On 2017-03-23 22:53 +0100, Arnout Vandecappelle spake thusly:
> > On 22-03-17 08:59, Thomas Petazzoni wrote:
> > > Hello,
> > > 
> > > On Wed, 22 Mar 2017 03:09:46 +0100, Waldemar Brodkorb wrote:
> > > 
> > >>> On Tue, 21 Mar 2017 20:32:13 +0100, Waldemar Brodkorb wrote:
> > >>>   
> > >>>> @@ -2,8 +2,8 @@ config BR2_PACKAGE_AUTOFS
> > >>>>  	bool "autofs"
> > >>>>  	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
> > >>>>  	depends on BR2_USE_MMU
> > >>>> -	depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC
> > >>>>  	depends on !BR2_STATIC_LIBS # dlfcn
> > >>>> +	select BR2_PACKAGE_LIBTIRPC  
> > >>>
> > >>> Why should we force people to use libtirpc ?   
> > >>
> > >> Because the internal RPC implementation is mostly useless and
> > >> getting removed?
> > > 
> > > I don't quite agree. The one in glibc has been used for years
> > > successfully, and is still useful. So even if uClibc decides to remove
> > > its internal RPC implementation, I'd like to give people the option to
> > > use the internal RPC implementation of glibc.
> > > 
> > > I agree RPC support in glibc will most likely disappear at some point
> > > in the future, but we're not there yet. So for now, I'd prefer if we
> > > just took the step of dropping RPC support in uClibc, and doing the
> > > necessary changes in packages so that they all build/work fine with
> > > libtirpc. That's anyway a very good preparation step to get rid of
> > > internal RPC support entirely at some point in the future.
> > 
> >  Well, if glibc is the only one that is still going to provide native RPC, I
> > really don't think it's worth keeping support for it. It's not as if the 125KB
> > extra from libtirpc are really going to hurt someone who is using glibc, right?
> > And keeping the option of native RPC or libtirpc is probably going to make the
> > code more complicated.
> > 
> >  So I tend to agree with Waldemar's approach.
> 
> I would say that I agree with Waldemar and Arnout.
> 
> Especially since the internal RPC implementation in glibc is not even
> complete (not IPv6-clean for example) so it really makes sense to switch
> to libtirpc which is nowadays pretty much stable.

Peter, any opinion?

best regards
 Waldemar
diff mbox

Patch

diff --git a/package/autofs/0004-libtirpc-via-pkgconfig.patch b/package/autofs/0004-libtirpc-via-pkgconfig.patch
new file mode 100644
index 0000000..784b4c6
--- /dev/null
+++ b/package/autofs/0004-libtirpc-via-pkgconfig.patch
@@ -0,0 +1,83 @@ 
+Use pkg-config to find libtirpc headers
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur autofs-5.1.2.orig/aclocal.m4 autofs-5.1.2/aclocal.m4
+--- autofs-5.1.2.orig/aclocal.m4	2016-06-15 04:40:44.000000000 +0200
++++ autofs-5.1.2/aclocal.m4	2017-03-21 20:10:06.441615642 +0100
+@@ -411,11 +411,18 @@
+ dnl --------------------------------------------------------------------------
+ AC_DEFUN([AF_CHECK_LIBTIRPC],
+ [
++
++AC_PATH_PROGS(PKG_CONFIG, pkg-config, no)
++
+ # save current flags
+ af_check_libtirpc_save_cflags="$CFLAGS"
+ af_check_libtirpc_save_ldflags="$LDFLAGS"
+-CFLAGS="$CFLAGS -I/usr/include/tirpc"
+-LDFLAGS="$LDFLAGS -ltirpc"
++
++TIRPC_LIBS=`$PKG_CONFIG --libs libtirpc`
++TIRPC_FLAGS=`$PKG_CONFIG --cflags libtirpc`
++
++CFLAGS="$CFLAGS $TIRPC_FLAGS"
++LIBS="$LIBS $TIRPC_LIBS"
+ 
+ AC_TRY_LINK(
+     [ #include <rpc/rpc.h> ],
+@@ -431,7 +438,8 @@
+ if test "$af_have_libtirpc" = "yes"; then
+     AC_DEFINE(WITH_LIBTIRPC,1, [Define to 1 if you have the libtirpc library installed])
+     AC_DEFINE(TIRPC_WORKAROUND,1, [Define to 1 to use the libtirpc tsd usage workaround])
+-    TIRPCLIB="-ltirpc"
++    TIRPCINCLUDE=$TIRPC_FLAGS
++    TIRPCLIB=$TIRPC_LIBS
+ fi
+ 
+ AC_CHECK_FUNCS([getrpcbyname getservbyname])
+@@ -439,6 +447,7 @@
+ # restore flags
+ CFLAGS="$af_check_libtirpc_save_cflags"
+ LDFLAGS="$af_check_libtirpc_save_ldflags"
++
+ ])
+ 
+ AC_DEFUN([AF_WITH_LIBTIRPC],
+diff -Nur autofs-5.1.2.orig/configure.in autofs-5.1.2/configure.in
+--- autofs-5.1.2.orig/configure.in	2016-06-15 04:40:44.000000000 +0200
++++ autofs-5.1.2/configure.in	2017-03-20 22:01:57.191254563 +0100
+@@ -126,6 +126,7 @@
+ #
+ AF_WITH_LIBTIRPC()
+ AC_SUBST(TIRPCLIB)
++AC_SUBST(TIRPCINCLUDE)
+ 
+ #
+ # Optional include dmalloc
+diff -Nur autofs-5.1.2.orig/Makefile.conf.in autofs-5.1.2/Makefile.conf.in
+--- autofs-5.1.2.orig/Makefile.conf.in	2016-06-15 04:40:44.000000000 +0200
++++ autofs-5.1.2/Makefile.conf.in	2017-03-20 21:59:38.341881802 +0100
+@@ -62,6 +62,7 @@
+ 
+ # Use libtirpc if requested and available
+ TIRPCLIB = @TIRPCLIB@
++TIRPCINCLUDE = @TIRPCINCLUDE@
+ 
+ # Use dmalloc for memory debuging
+ DMALLOCLIB = @DMALLOCLIB@
+diff -Nur autofs-5.1.2.orig/Makefile.rules autofs-5.1.2/Makefile.rules
+--- autofs-5.1.2.orig/Makefile.rules	2016-06-15 04:40:44.000000000 +0200
++++ autofs-5.1.2/Makefile.rules	2017-03-20 22:03:25.590675167 +0100
+@@ -45,10 +45,8 @@
+ CFLAGS += -D_REENTRANT -D_FILE_OFFSET_BITS=64
+ LIBS += -lpthread
+ 
+-ifdef TIRPCLIB
+-CFLAGS += -I/usr/include/tirpc
++CFLAGS += $(TIRPCINCLUDE)
+ LIBS += $(TIRPCLIB)
+-endif
+ 
+ ifdef DMALLOCLIB
+ LIBS += $(DMALLOCLIB)
diff --git a/package/autofs/Config.in b/package/autofs/Config.in
index 8e08357..bf1bf47 100644
--- a/package/autofs/Config.in
+++ b/package/autofs/Config.in
@@ -2,8 +2,8 @@  config BR2_PACKAGE_AUTOFS
 	bool "autofs"
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_USE_MMU
-	depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	depends on !BR2_STATIC_LIBS # dlfcn
+	select BR2_PACKAGE_LIBTIRPC
 	help
 	  Autofs controls the operation of the automount daemons. The
 	  automount daemons automatically mount filesystems when they
@@ -15,7 +15,6 @@  config BR2_PACKAGE_AUTOFS
 
 	  http://www.linuxfromscratch.org/blfs/view/svn/general/autofs.html
 
-comment "autofs needs a toolchain w/ NPTL, RPC, dynamic library"
+comment "autofs needs a toolchain w/ NPTL and dynamic library"
 	depends on BR2_USE_MMU
-	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || BR2_STATIC_LIBS || \
-		!BR2_TOOLCHAIN_HAS_NATIVE_RPC
+	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || BR2_STATIC_LIBS
diff --git a/package/autofs/autofs.mk b/package/autofs/autofs.mk
index 23e6836..1add8b2 100644
--- a/package/autofs/autofs.mk
+++ b/package/autofs/autofs.mk
@@ -9,7 +9,7 @@  AUTOFS_SOURCE = autofs-$(AUTOFS_VERSION).tar.xz
 AUTOFS_SITE = $(BR2_KERNEL_MIRROR)/linux/daemons/autofs/v5
 AUTOFS_LICENSE = GPLv2+
 AUTOFS_LICENSE_FILES = COPYING COPYRIGHT
-AUTOFS_DEPENDENCIES = host-flex host-bison
+AUTOFS_DEPENDENCIES = host-flex host-bison libtirpc host-pkgconf
 # For 0002-autofs-configure-check-for-clock_gettime-in-librt.patch and
 # 0003-configure-add-cache-variable-for-Linux-proc-filesyst.patch.
 AUTOFS_AUTORECONF = YES
@@ -27,6 +27,7 @@  AUTOFS_CONF_ENV = \
 AUTOFS_CONF_OPTS = \
 	--disable-mount-locking \
 	--enable-ignore-busy \
+	--with-libtirpc \
 	--without-openldap \
 	--without-sasl \
 	--with-path="$(BR_PATH)" \