mailing list of musl libc
 help / color / mirror / code / Atom feed
* Re: [alpine-devel] Non-standard C library
       [not found]                 ` <717ca2a3-d579-4ab6-ace2-1bc0dbbb111c@skogtun.org>
@ 2017-01-31 18:50                   ` William Pitcock
  2017-01-31 19:08                     ` A. Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: William Pitcock @ 2017-01-31 18:50 UTC (permalink / raw)
  To: Harald Arnesen; +Cc: alpine-dev, musl

Hello,

On Tue, Jan 31, 2017 at 12:22 PM, Harald Arnesen <harald@skogtun.org> wrote:
> musl defines "IPPORT_RESERVED" in "netdb.h", while both GNU libc and BSD
> libc define it in "netinet/in.h". And I can't find an e-mail address for
> a musl developer without subscribing to their mailing list.
>
>
> This is from a conversation with Snobol maintainer Phil Budne:
>
>> > This one is from an old Asus EeePC 900, running AlpineLinux, which uses
>> > the musl libc instead of glibc. A compile error ('IPPORT_RESERVED'
>> > undeclared) in 'lib/auxil/bindresvport.c' was fixed by
>> > '#include <netdb.h>'
>
> Thanks!
>
> I'd report it as a bug in libc....  IPPORT_RESERVED is a property of
> on the wire protocol (or at least the local TCP stack), while
> <netdb.h> is the interface for hostname lookups.
>
> Linux and BSD agree the constant comes from netinet/in.h
>
> And charmingly, they refuse to define an ifdef so you can tell
> you're using their broken library (because they're never wrong):
>
> http://wiki.musl-libc.org/wiki/FAQ#Q:_why_is_there_no_MUSL_macro_.3F
>
> I've put this in after #include <errno.h>:
>
> #if !defined(IPPORT_RESERVED) && !defined(__GLIBC__)
> /*
>  * could be using broken musl libc!
>  * they refuse to identify themselves:
>  * http://wiki.musl-libc.org/wiki/FAQ#Q:_why_is_there_no_MUSL_macro_.3F
>  */
> #include <netdb.h>
> #endif

I checked on both a Debian and FreeBSD machine and indeed, they both
have it in netinet/in.h.

What shall we do?

William


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: [alpine-devel] Non-standard C library
  2017-01-31 18:50                   ` [alpine-devel] Non-standard C library William Pitcock
@ 2017-01-31 19:08                     ` A. Wilcox
  2017-01-31 19:23                       ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: A. Wilcox @ 2017-01-31 19:08 UTC (permalink / raw)
  To: musl

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 31/01/17 12:50, William Pitcock wrote:
> On Tue, Jan 31, 2017 at 12:22 PM, Harald Arnesen 
> <harald@skogtun.org> wrote:
>> musl defines "IPPORT_RESERVED" in "netdb.h", while both GNU libc 
>> and BSD libc define it in "netinet/in.h". And I can't find an 
>> e-mail address for a musl developer without subscribing to their 
>> mailing list.


POSIX.1-2008 clearly says IPPORT_RESERVED shall be defined in <netdb.h>:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html

....


> I checked on both a Debian and FreeBSD machine and indeed, they 
> both have it in netinet/in.h.

....

however, POSIX.1-2008 also clearly says <netdb.h> "may also make visible
all symbols from <netinet/in.h>".


> What shall we do?


Theoretically, the code they are compiling is wrong; POSIX only
guarantees the definition in <netdb.h>.  However, there is a bit of
leeway in the standard since <netdb.h> may include all symbols from
<netinet/in.h>; if it's defined there, <netdb.h> can pull that header
in providing the definition.

I would say that the best thing to do in the interests of
compatibility would be to put the definition in <netinet/in.h> *and*
fix whatever broken project that is (Snobol?) to include <netdb.h>.
This is what FreeBSD and glibc both do; define it in <netinet/in.h>
and include that header in <netdb.h>.

- --arw

- -- 
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJYkOCRAAoJEMspy1GSK50Uuv4P/04VgUNWW2Dg50BNiF7zbvE8
KDEF6N781XwcwIO31+ndIRGWo0+CiHHtOHjyZ+Wspr6Zcu5/Lrpau/XAaPXHq/0B
Tu64tZxoCBuuXpyqu+fKR/wxyXDEY0YD7SRnLQc4k5QwjskAKPnt1UyvsC6pmwaW
Jy+zj91cVWlthfoFzNigprhIJ3TPCFRlZCnmnzDvK2hQZRNTR70LXpSN7ZoZjIl5
xxHVsErjMA9PWTeyFLYJ72rAwTvuFgszD9Gqo8o2WcAr8VKpdgjeoFcmC017fEHr
ajQcmpbCrEeo7stMRu7lGmoktnOnA+UAnNrTak44Eic2n6bNrK29Sa6TuB4xEg3u
3+NH/jMA8lsoMtOrdiCtLio56pU8eezP5Z4JDQE0RhKXonAF7io87FNIdJ3s6z/6
dMHXDb69hSxS60YEX1S/5djFbfXkv8PkfEsdu+e5mSTOVmFBK/FyAj52q3rrvz17
rkdYH7i0EBQJnYB2B4SKjJrgrVDBAETxue/H5sdbLFKqryMS3HPEdsJSR2Ks2Aj5
pJmdhAG3upsgMgPuyLzHcOUec3dytRIE6zo45bHgTtFuWN8031bajovp9G3Wigyj
vMDKxlNI4vwW4YQd4P5bd8ZuHzBnwvF65+AOW+yMahEzURz87X6FVm1u+xEZlV1d
gE5t9bvOnDE7+1VRtfwo
=xIKa
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: [alpine-devel] Non-standard C library
  2017-01-31 19:08                     ` A. Wilcox
@ 2017-01-31 19:23                       ` Rich Felker
  2017-01-31 19:37                         ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2017-01-31 19:23 UTC (permalink / raw)
  To: musl

On Tue, Jan 31, 2017 at 01:08:07PM -0600, A. Wilcox wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On 31/01/17 12:50, William Pitcock wrote:
> > On Tue, Jan 31, 2017 at 12:22 PM, Harald Arnesen 
> > <harald@skogtun.org> wrote:
> >> musl defines "IPPORT_RESERVED" in "netdb.h", while both GNU libc 
> >> and BSD libc define it in "netinet/in.h". And I can't find an 
> >> e-mail address for a musl developer without subscribing to their 
> >> mailing list.
> 
> 
> POSIX.1-2008 clearly says IPPORT_RESERVED shall be defined in <netdb.h>:
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html
> 
> .....
> 
> 
> > I checked on both a Debian and FreeBSD machine and indeed, they 
> > both have it in netinet/in.h.
> 
> .....
> 
> however, POSIX.1-2008 also clearly says <netdb.h> "may also make visible
> all symbols from <netinet/in.h>".
> 
> 
> > What shall we do?
> 
> 
> Theoretically, the code they are compiling is wrong; POSIX only
> guarantees the definition in <netdb.h>.  However, there is a bit of
> leeway in the standard since <netdb.h> may include all symbols from
> <netinet/in.h>; if it's defined there, <netdb.h> can pull that header
> in providing the definition.
> 
> I would say that the best thing to do in the interests of
> compatibility would be to put the definition in <netinet/in.h> *and*
> fix whatever broken project that is (Snobol?) to include <netdb.h>.
> This is what FreeBSD and glibc both do; define it in <netinet/in.h>
> and include that header in <netdb.h>.

The name IPPORT_RESERVED is not reserved in the namespace for
netinet/in.h, so it can't be added there unless it's conditional on
nonstandard feature profile. That might be justifiable if lots of
applications had the wrong expectation here, but being that this is
the first time we've heard of the issue, it seems there are just a few
(or only one) applications which are doing this wrong, and they should
just be fixed.

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: [alpine-devel] Non-standard C library
  2017-01-31 19:23                       ` Rich Felker
@ 2017-01-31 19:37                         ` Rich Felker
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2017-01-31 19:37 UTC (permalink / raw)
  To: musl

On Tue, Jan 31, 2017 at 02:23:10PM -0500, Rich Felker wrote:
> On Tue, Jan 31, 2017 at 01:08:07PM -0600, A. Wilcox wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA256
> > 
> > On 31/01/17 12:50, William Pitcock wrote:
> > > On Tue, Jan 31, 2017 at 12:22 PM, Harald Arnesen 
> > > <harald@skogtun.org> wrote:
> > >> musl defines "IPPORT_RESERVED" in "netdb.h", while both GNU libc 
> > >> and BSD libc define it in "netinet/in.h". And I can't find an 
> > >> e-mail address for a musl developer without subscribing to their 
> > >> mailing list.
> > 
> > 
> > POSIX.1-2008 clearly says IPPORT_RESERVED shall be defined in <netdb.h>:
> > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html
> > 
> > .....
> > 
> > 
> > > I checked on both a Debian and FreeBSD machine and indeed, they 
> > > both have it in netinet/in.h.
> > 
> > .....
> > 
> > however, POSIX.1-2008 also clearly says <netdb.h> "may also make visible
> > all symbols from <netinet/in.h>".
> > 
> > 
> > > What shall we do?
> > 
> > 
> > Theoretically, the code they are compiling is wrong; POSIX only
> > guarantees the definition in <netdb.h>.  However, there is a bit of
> > leeway in the standard since <netdb.h> may include all symbols from
> > <netinet/in.h>; if it's defined there, <netdb.h> can pull that header
> > in providing the definition.
> > 
> > I would say that the best thing to do in the interests of
> > compatibility would be to put the definition in <netinet/in.h> *and*
> > fix whatever broken project that is (Snobol?) to include <netdb.h>.
> > This is what FreeBSD and glibc both do; define it in <netinet/in.h>
> > and include that header in <netdb.h>.
> 
> The name IPPORT_RESERVED is not reserved in the namespace for
> netinet/in.h, so it can't be added there unless it's conditional on
> nonstandard feature profile. That might be justifiable if lots of
> applications had the wrong expectation here, but being that this is
> the first time we've heard of the issue, it seems there are just a few
> (or only one) applications which are doing this wrong, and they should
> just be fixed.

I seem to have overlooked it in the second table of reserved names:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_02

so it does seem like we could reasonably move it to netinet/in.h.

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-31 19:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CA+T2pCEB9g=un1jx0x2k+wKNQWeBt8hijEwq1Yy+qLLvb0OVrw@mail.gmail.com>
     [not found] ` <20170126112655.44ad5c0e@vostro.util.wtbts.net>
     [not found]   ` <4EDA0683-3991-44D0-882C-C34FBD4C38B2@jirutka.cz>
     [not found]     ` <i2ems4.oke5ti.1hge1d6-qmf@gmx.com>
     [not found]       ` <CA+T2pCF+dFPhWBKcwdUSp_Fr1Jk=rT1Pweap6iPZMXjf6HFi8g@mail.gmail.com>
     [not found]         ` <5blaf1.okfi73.2tnq26-qmf@gmx.com>
     [not found]           ` <CA+T2pCErwS_KFW98fvJ86-cx-dmpruxeCVKu-gG-2Ud08UVwpw@mail.gmail.com>
     [not found]             ` <5890704A.8090402@mail.com>
     [not found]               ` <CA+T2pCHJ9-aOzd_A2=5W_eF__ja+uC4yPf6LPyOQpxJKKAreUQ@mail.gmail.com>
     [not found]                 ` <717ca2a3-d579-4ab6-ace2-1bc0dbbb111c@skogtun.org>
2017-01-31 18:50                   ` [alpine-devel] Non-standard C library William Pitcock
2017-01-31 19:08                     ` A. Wilcox
2017-01-31 19:23                       ` Rich Felker
2017-01-31 19:37                         ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).