Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 589666

Summary: net-nds/rpcbind-0.2.3-r1 patches to compile successfully on musl
Product: Gentoo Linux Reporter: Daniel Kuehn (RETIRED) <lejonet>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: musl
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 430702    
Attachments: Put #ifdef around include of sys/queue.h
Remove the usage of the __P() GNU extension
Remove the include of sys/queue.h as its not used
Remove the usage of the __P() GNU extension, removes extranous space
upstream patch

Description Daniel Kuehn (RETIRED) gentoo-dev 2016-07-25 10:27:29 UTC
Created attachment 441504 [details]
Put #ifdef around include of sys/queue.h

RPCbind needs some patches to compile on musl libc, because RPCbind uses sys/queue.h, which isn't POSIX and uses GNU specific extensions.
Comment 1 Daniel Kuehn (RETIRED) gentoo-dev 2016-07-25 10:30:33 UTC
Created attachment 441506 [details]
Remove the usage of the __P() GNU extension

This patch shouldn't be applied unconditionally, which is okay to do with the other patch, so this patch should preferably be guarded by if use elibc_musl; then epatch $PATH; fi in src_prepare function.
Comment 2 Felix Janda 2016-07-25 17:48:50 UTC
Thanks for the patches!

Regarding attachment 441504 [details], the <sys/queue.h> include can be removed
unconditionally. It is not used.

Why does attachment 441506 [details] need to be applied conditionally on
elibc_musl? The __P macro (also present for example on BSDs) is for
compatibility for long obsolete K&R C-compilers. For ANSI C compilers
__P(x) is the same as x. Before suggesting the patch upstream I would
remove the now extraneous space between the function name and the
opening bracket.
Comment 3 Daniel Kuehn (RETIRED) gentoo-dev 2016-08-21 21:03:06 UTC
Ah okay, then I'll make a new patch that just removes it.

To be honest, I didn't really look at what the __P() macro was supposed to do, but when I googled around __P() and musl, it was clear that it was a non-compatible macro with musl, so then we maybe should just apply it unconditionally and be done with it.

Sorry for late reply, completely missed that you had commented.
Comment 4 Daniel Kuehn (RETIRED) gentoo-dev 2016-08-25 18:59:49 UTC
Created attachment 444122 [details, diff]
Remove the include of sys/queue.h as its not used
Comment 5 Daniel Kuehn (RETIRED) gentoo-dev 2016-08-25 19:06:26 UTC
Created attachment 444124 [details, diff]
Remove the usage of the __P() GNU extension, removes extranous space
Comment 6 Anthony Basile gentoo-dev 2016-10-02 15:37:35 UTC
(In reply to Daniel Kuehn from comment #5)
> Created attachment 444124 [details, diff] [details, diff]
> Remove the usage of the __P() GNU extension, removes extranous space

__P() is in sys/cdefs.h and it used to be used to set up protoypes for brain dead compilers.  Its definition has been reduced to

/* These two macros are not used in glibc anymore.  They are kept here
   only because some other projects expect the macros to be defined.  */
#define __P(args)       args
#define __PMT(args)     args


You're patch is overkill.  Just find with sys/cdefs.h is pulled in and add the following:

#undef __P
#define __P(args) args

That should then build on all libcs.  Please test on both musl and glibc and if it works, apply the patch unconditionally to the ebuild.

I'll add it to the tree.
Comment 7 Felix Janda 2016-10-02 19:49:42 UTC
I agree that we probably want to use the smaller patch.

The larger patch is however the correct one to be submitted upstream.
Actually, the __P() issue was already fixed upstream:

http://git.linux-nfs.org/?p=steved/rpcbind.git;a=commit;h=196e8f3abaa6e8899ba2655c6c2d8751e33a9795

Could someone send the other patch to linux-nfs@vger.kernel.org?
Comment 8 Anthony Basile gentoo-dev 2016-10-02 21:31:03 UTC
(In reply to Felix Janda from comment #7)
> I agree that we probably want to use the smaller patch.
> 
> The larger patch is however the correct one to be submitted upstream.
> Actually, the __P() issue was already fixed upstream:
> 
> http://git.linux-nfs.org/?p=steved/rpcbind.git;a=commit;
> h=196e8f3abaa6e8899ba2655c6c2d8751e33a9795
> 
> Could someone send the other patch to linux-nfs@vger.kernel.org?

Can't we just backport that patch?  Or is there a newer release I can add to the tree?
Comment 9 Felix Janda 2016-10-02 22:51:20 UTC
Created attachment 448918 [details, diff]
upstream patch

The patch is taken straight from upstream git, and it at least applies
to version 0.2.3. It is not part of the current version 0.2.4-rc1.
Comment 10 Anthony Basile gentoo-dev 2016-10-06 21:29:23 UTC
(In reply to Felix Janda from comment #9)
> Created attachment 448918 [details, diff] [details, diff]
> upstream patch
> 
> The patch is taken straight from upstream git, and it at least applies
> to version 0.2.3. It is not part of the current version 0.2.4-rc1.

okay i added 0.2.3-r2 with this patch and tested.  its ~arch so we may want to stabilize it soon.