Thread: Errors compiling hba.c in current CVS

Errors compiling hba.c in current CVS

From
Bruno Wolff III
Date:
I get the errors below when compiling on a RH 6.1 system.
I used the following config paramters:
./configure --prefix=/usr/local/pgsql --enable-integer-datetimes --with-pgport=5433

hba.c: In function `parse_hba':
hba.c:590: structure has no member named `ss_family'
hba.c:659: structure has no member named `ss_family'
hba.c:691: structure has no member named `ss_family'
hba.c: In function `ident_inet':
hba.c:1210: structure has no member named `ss_family'
hba.c: In function `authident':
hba.c:1461: structure has no member named `ss_family'
hba.c:1467: warning: unreachable code at beginning of switch statement
make[3]: *** [hba.o] Error 1


Re: Errors compiling hba.c in current CVS

From
Bruno Wolff III
Date:
On Mon, Jun 16, 2003 at 11:47:58 -0500, Bruno Wolff III <bruno@wolff.to> wrote:
> I get the errors below when compiling on a RH 6.1 system.
> I used the following config paramters:
> ./configure --prefix=/usr/local/pgsql --enable-integer-datetimes --with-pgport=5433
> 
> hba.c: In function `parse_hba':
> hba.c:590: structure has no member named `ss_family'
> hba.c:659: structure has no member named `ss_family'
> hba.c:691: structure has no member named `ss_family'
> hba.c: In function `ident_inet':
> hba.c:1210: structure has no member named `ss_family'
> hba.c: In function `authident':
> hba.c:1461: structure has no member named `ss_family'
> hba.c:1467: warning: unreachable code at beginning of switch statement
> make[3]: *** [hba.o] Error 1

I looked into this a bit more and found ss_family is defined in pqcomm.h
which is included in auth.c which compiles and not in either hba.c or
ip.c which don't compile.


Re: Errors compiling hba.c in current CVS

From
Bruce Momjian
Date:
I am working on this now.  The missing typedef for sa_family_t is really
just used for structure alignment, so I am working on a fix to define a
char array and #define to be the same length as the native ss_family,
because on my system sa_family_t is:
       sys/sockettypes.h:11:typedef u_char sa_family_t;

which seems to contradict the unsigned short as found by Jason on
Cygwin, so it seems I will have to pull out the real family length, and
use that in the structure.

---------------------------------------------------------------------------


Bruno Wolff III wrote:
> On Mon, Jun 16, 2003 at 11:47:58 -0500,
>   Bruno Wolff III <bruno@wolff.to> wrote:
> > I get the errors below when compiling on a RH 6.1 system.
> > I used the following config paramters:
> > ./configure --prefix=/usr/local/pgsql --enable-integer-datetimes --with-pgport=5433
> > 
> > hba.c: In function `parse_hba':
> > hba.c:590: structure has no member named `ss_family'
> > hba.c:659: structure has no member named `ss_family'
> > hba.c:691: structure has no member named `ss_family'
> > hba.c: In function `ident_inet':
> > hba.c:1210: structure has no member named `ss_family'
> > hba.c: In function `authident':
> > hba.c:1461: structure has no member named `ss_family'
> > hba.c:1467: warning: unreachable code at beginning of switch statement
> > make[3]: *** [hba.o] Error 1
> 
> I looked into this a bit more and found ss_family is defined in pqcomm.h
> which is included in auth.c which compiles and not in either hba.c or
> ip.c which don't compile.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: Errors compiling hba.c in current CVS

From
Kurt Roeckx
Date:
On Mon, Jun 16, 2003 at 03:36:55PM -0400, Bruce Momjian wrote:
> 
> I am working on this now.  The missing typedef for sa_family_t is really
> just used for structure alignment, so I am working on a fix to define a
> char array and #define to be the same length as the native ss_family,
> because on my system sa_family_t is:
> 
>         sys/sockettypes.h:11:typedef u_char sa_family_t;
> 
> which seems to contradict the unsigned short as found by Jason on
> Cygwin, so it seems I will have to pull out the real family length, and
> use that in the structure.

You have systems using BSD 4.3 where sa_family is an unsigned short, 
and BSD 4.4, where they split it up in sa_len (a u_char) and a
sa_family (also a u_char).

I was wondering about just using the SALEN to define what we
want.


Kurt



Re: Errors compiling hba.c in current CVS

From
Kurt Roeckx
Date:
On Mon, Jun 16, 2003 at 02:23:31PM -0500, Bruno Wolff III wrote:
> On Mon, Jun 16, 2003 at 11:47:58 -0500,
>   Bruno Wolff III <bruno@wolff.to> wrote:
> > I get the errors below when compiling on a RH 6.1 system.
> > I used the following config paramters:
> > ./configure --prefix=/usr/local/pgsql --enable-integer-datetimes --with-pgport=5433
> > 
> > hba.c: In function `parse_hba':
> > hba.c:590: structure has no member named `ss_family'
> > hba.c:659: structure has no member named `ss_family'
> > hba.c:691: structure has no member named `ss_family'
> > hba.c: In function `ident_inet':
> > hba.c:1210: structure has no member named `ss_family'
> > hba.c: In function `authident':
> > hba.c:1461: structure has no member named `ss_family'
> > hba.c:1467: warning: unreachable code at beginning of switch statement
> > make[3]: *** [hba.o] Error 1
> 
> I looked into this a bit more and found ss_family is defined in pqcomm.h
> which is included in auth.c which compiles and not in either hba.c or
> ip.c which don't compile.

It doesn't say it doesn't know the structure, but it says it
doesn't know the member, which is very confusing to me.

It's not making any sense at all.  The SockAddr is defined in
the same file, and it doesn't seem to give an error on that.
SockAddr also uses the struct sockaddr_storage.

hba.c includes libpq/libpq.h, which in his turn includes
libpq/ip.h, which finaly includes libpq/pqcomm.h, so that
shouldn't be a problem.


Kurt



Re: Errors compiling hba.c in current CVS

From
Bruce Momjian
Date:
Does the following patch fix the problem?  It doesn't use sa_family_t
anymore.


---------------------------------------------------------------------------

Kurt Roeckx wrote:
> On Mon, Jun 16, 2003 at 02:23:31PM -0500, Bruno Wolff III wrote:
> > On Mon, Jun 16, 2003 at 11:47:58 -0500,
> >   Bruno Wolff III <bruno@wolff.to> wrote:
> > > I get the errors below when compiling on a RH 6.1 system.
> > > I used the following config paramters:
> > > ./configure --prefix=/usr/local/pgsql --enable-integer-datetimes --with-pgport=5433
> > >
> > > hba.c: In function `parse_hba':
> > > hba.c:590: structure has no member named `ss_family'
> > > hba.c:659: structure has no member named `ss_family'
> > > hba.c:691: structure has no member named `ss_family'
> > > hba.c: In function `ident_inet':
> > > hba.c:1210: structure has no member named `ss_family'
> > > hba.c: In function `authident':
> > > hba.c:1461: structure has no member named `ss_family'
> > > hba.c:1467: warning: unreachable code at beginning of switch statement
> > > make[3]: *** [hba.o] Error 1
> >
> > I looked into this a bit more and found ss_family is defined in pqcomm.h
> > which is included in auth.c which compiles and not in either hba.c or
> > ip.c which don't compile.
>
> It doesn't say it doesn't know the structure, but it says it
> doesn't know the member, which is very confusing to me.
>
> It's not making any sense at all.  The SockAddr is defined in
> the same file, and it doesn't seem to give an error on that.
> SockAddr also uses the struct sockaddr_storage.
>
> hba.c includes libpq/libpq.h, which in his turn includes
> libpq/ip.h, which finaly includes libpq/pqcomm.h, so that
> shouldn't be a problem.
>
>
> Kurt
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/include/libpq/pqcomm.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/libpq/pqcomm.h,v
retrieving revision 1.86
diff -c -c -r1.86 pqcomm.h
*** src/include/libpq/pqcomm.h    12 Jun 2003 07:36:51 -0000    1.86
--- src/include/libpq/pqcomm.h    16 Jun 2003 21:11:09 -0000
***************
*** 43,57 ****
  /*
   * Definitions used for sockaddr_storage structure paddings design.
   */
! #define    _SS_PAD1SIZE    (_SS_ALIGNSIZE - sizeof (sa_family_t))
! #define    _SS_PAD2SIZE    (_SS_MAXSIZE - (sizeof (sa_family_t) + \
                  _SS_PAD1SIZE + _SS_ALIGNSIZE))

  struct sockaddr_storage {
  #ifdef SALEN
      uint8_t    __ss_len;        /* address length */
  #endif
!     sa_family_t    ss_family;    /* address family */

      char    __ss_pad1[_SS_PAD1SIZE];
          /* 6 byte pad, this is to make implementation
--- 43,60 ----
  /*
   * Definitions used for sockaddr_storage structure paddings design.
   */
! /* Some platforms don't have sa_family_t, so we compute it ourselves */
! #define SIZEOF_SOCKADDR_FAMILY        sizeof(((struct sockaddr *)0)->sa_family)
!
! #define    _SS_PAD1SIZE    (_SS_ALIGNSIZE - SIZEOF_SOCKADDR_FAMILY)
! #define    _SS_PAD2SIZE    (_SS_MAXSIZE - (SIZEOF_SOCKADDR_FAMILY + \
                  _SS_PAD1SIZE + _SS_ALIGNSIZE))

  struct sockaddr_storage {
  #ifdef SALEN
      uint8_t    __ss_len;        /* address length */
  #endif
!     char dummy_sa_family[SIZEOF_SOCKADDR_FAMILY];

      char    __ss_pad1[_SS_PAD1SIZE];
          /* 6 byte pad, this is to make implementation

Re: Errors compiling hba.c in current CVS

From
Bruno Wolff III
Date:
On Mon, Jun 16, 2003 at 17:21:01 -0400, Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> 
> Does the following patch fix the problem?  It doesn't use sa_family_t
> anymore.

I tried using the pacth and it didn't help. I am going to get a fresh
CVS copy and see if that works.


Re: Errors compiling hba.c in current CVS

From
Kurt Roeckx
Date:
On Mon, Jun 16, 2003 at 05:21:01PM -0400, Bruce Momjian wrote:
> 
> Does the following patch fix the problem?  It doesn't use sa_family_t
> anymore.
> 
> !     sa_family_t    ss_family;    /* address family */
[...]
> !     char dummy_sa_family[SIZEOF_SOCKADDR_FAMILY];

That is NOT going to work. Not only did you change the only
member of the struct we use, you changed it into an array.

Something like this might do it:

#if SIZEOF_SOCKADDR_FAMILY == 1uint8_t        ss_family;
#elif SIZEOF_SOCKADDR_FAMILY == 2uint16_t    ss_family;
#else
#error unsupported sa_family size
#endif


And isn't this patch more for an other thread anyway?


Kurt



Re: Errors compiling hba.c in current CVS

From
Bruno Wolff III
Date:
On Mon, Jun 16, 2003 at 17:21:01 -0400, Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> 
> Does the following patch fix the problem?  It doesn't use sa_family_t
> anymore.

I tried current CVS and current CVS with the patch you attached and it
still didn't work.