Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-03-20 Thread Alejandro Colomar via Gcc
Hi Bastien and Eric! On 3/18/23 08:54, roucaries bastien wrote: > Hi, > > I have opened a defect at austin group > https://www.austingroupbugs.net/view.php?id=1641 Sorry for not having prepared yet my report as I promised to Eric. I've been busy with other stuff, but still had in mind doing it

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-03-18 Thread roucaries bastien via Gcc
Hi, I have opened a defect at austin group https://www.austingroupbugs.net/view.php?id=1641 Bastien Le lun. 6 févr. 2023 à 18:45, Eric Blake a écrit : > > On Sun, Feb 05, 2023 at 04:28:36PM +0100, Alejandro Colomar wrote: > > Regardless of the merits of the patch, let's not introduce typos: >

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-06 Thread Alejandro Colomar via Gcc
Hello Eric, On 2/6/23 19:45, Eric Blake wrote: On Sun, Feb 05, 2023 at 04:28:36PM +0100, Alejandro Colomar wrote: Regardless of the merits of the patch, let's not introduce typos: +++ b/man3type/sockaddr.3type @@ -120,6 +120,26 @@ .SH NOTES .I and .IR . +.SH BUGS +.I sockaddr_storage

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-06 Thread Eric Blake via Gcc
On Sun, Feb 05, 2023 at 04:28:36PM +0100, Alejandro Colomar wrote: Regardless of the merits of the patch, let's not introduce typos: > +++ b/man3type/sockaddr.3type > @@ -120,6 +120,26 @@ .SH NOTES > .I > and > .IR . > +.SH BUGS > +.I sockaddr_storage > +was designed back when strict

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-06 Thread Rich Felker
On Mon, Feb 06, 2023 at 03:11:10PM +0100, Alejandro Colomar wrote: > Hi Rich, > > On 2/6/23 14:38, Rich Felker wrote: > >There is absolutely not any need to declare the union for application > >code calling the socket APIs. You declare whatever type you will be > >using. For binding or connecting

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-06 Thread Alejandro Colomar via Gcc
Hi Rich, On 2/6/23 14:38, Rich Felker wrote: There is absolutely not any need to declare the union for application code calling the socket APIs. You declare whatever type you will be using. For binding or connecting a unix socket, sockaddr_un. For IPv6, sockaddr_in6. Etc. Then you cast the

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-06 Thread Rich Felker
On Mon, Feb 06, 2023 at 12:55:12PM +0100, Alejandro Colomar wrote: > Hi Xi, > > On 2/6/23 07:02, Xi Ruoyao wrote: > >On Sun, 2023-02-05 at 16:31 +0100, Alejandro Colomar via Libc-alpha wrote: > > > >>The only correct way to use  different  types  in  an  API  is > >>through  a  union. > > > >I

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-06 Thread Alejandro Colomar via Gcc
Hi Xi, On 2/6/23 07:02, Xi Ruoyao wrote: On Sun, 2023-02-05 at 16:31 +0100, Alejandro Colomar via Libc-alpha wrote: The only correct way to use  different  types  in  an  API  is through  a  union. I don't think this statement is true (in general). Technically we can write something like

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-06 Thread Rich Felker
On Mon, Feb 06, 2023 at 02:02:23PM +0800, Xi Ruoyao wrote: > On Sun, 2023-02-05 at 16:31 +0100, Alejandro Colomar via Libc-alpha wrote: > > > The only correct way to use  different  types  in  an  API  is > > through  a  union. > > I don't think this statement is true (in general). Technically

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-05 Thread Xi Ruoyao via Gcc
On Sun, 2023-02-05 at 16:31 +0100, Alejandro Colomar via Libc-alpha wrote: > The only correct way to use  different  types  in  an  API  is > through  a  union. I don't think this statement is true (in general). Technically we can write something like this: struct sockaddr { ... }; struct

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-05 Thread Rich Felker
On Mon, Feb 06, 2023 at 12:59:48AM +0100, Alejandro Colomar wrote: > Hi Rich, > > On 2/6/23 00:43, Rich Felker wrote: > >On Sun, Feb 05, 2023 at 04:28:36PM +0100, Alejandro Colomar wrote: > >>As discussed before, and Bastien and I seem to agree, ideally we should > >>define the following types: >

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-05 Thread Alejandro Colomar via Gcc
Hi Rich, On 2/6/23 00:43, Rich Felker wrote: On Sun, Feb 05, 2023 at 04:28:36PM +0100, Alejandro Colomar wrote: As discussed before, and Bastien and I seem to agree, ideally we should define the following types: struct sockaddr_storage { union { struct {

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-05 Thread Rich Felker
On Sun, Feb 05, 2023 at 04:28:36PM +0100, Alejandro Colomar wrote: > As discussed before, and Bastien and I seem to agree, ideally we should > define the following types: > > struct sockaddr_storage { > union { > struct { > sa_family_t ss_family; >

Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-05 Thread Alejandro Colomar via Gcc
Formatted version: BUGS sockaddr_storage was designed back when strict aliasing wasn’t a prob‐ lem. Back then, one would define a variable of that type, and then ac‐ cess it as any of the other sockaddr_* types, depending on the value of the first member. This

[PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union

2023-02-05 Thread Alejandro Colomar via Gcc
As discussed before, and Bastien and I seem to agree, ideally we should define the following types: struct sockaddr_storage { union { struct { sa_family_t ss_family; }; struct sockaddr_in sin; struct sockaddr_in6