pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18995: Building with GCC 14 fails:  incompatible pointer struct pam_message
8+ messages / 3 participants
[nested] [flat]

* BUG #18995: Building with GCC 14 fails:  incompatible pointer struct pam_message
@ 2025-07-23 10:00  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 8+ messages in thread

From: PG Bug reporting form @ 2025-07-23 10:00 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: awatkins1966@gmail.com

The following bug has been logged on the website:

Bug reference:      18995
Logged by:          Andrew Watkins
Email address:      awatkins1966@gmail.com
PostgreSQL version: 17.5
Operating system:   Solaris 11.4
Description:        

Hello,
Not sure if a Oracle Solaris problem or not.

First, PostgreSQL 17.5 with GCC v13 builds cleaning and runs on Solaris
11.4, but building with GCC v14 I get the following:

gcc -m64 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type
-Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation
-O2 -I../../../src/include  -D_POSIX_PTHREAD_SEMANTICS
-I/usr/include/libxml2   -c -o auth.o auth.c
auth.c:101:9: error: initialization of 'int (*)(int,  struct pam_message **,
struct pam_response **, void *)' from incompatible pointer type 'int
(*)(int,  const struct pam_message **, struct pam_response **, void *)'
[-Wincompatible-pointer-types]
  101 |         &pam_passwd_conv_proc,
      |         ^
auth.c:101:9: note: (near initialization for 'pam_passw_conv.conv')
gmake[3]: *** [<builtin>: auth.o] Error 1
gmake[3]: Leaving directory
'/home/andrew/src/postgresql-17.5/src/backend/libpq'
gmake[2]: *** [common.mk:37: libpq-recursive] Error 2
gmake[2]: Leaving directory '/home/andrew/src/postgresql-17.5/src/backend'
gmake[1]: *** [Makefile:42: all-backend-recurse] Error 2
gmake[1]: Leaving directory '/home/andrew/src/postgresql-17.5/src'
gmake: *** [GNUmakefile:11: all-src-recurse] Error 2

Thanks,
Andrew



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

* Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message
@ 2025-07-23 14:27  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 2 replies; 8+ messages in thread

From: Tom Lane @ 2025-07-23 14:27 UTC (permalink / raw)
  To: awatkins1966@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> First, PostgreSQL 17.5 with GCC v13 builds cleaning and runs on Solaris
> 11.4, but building with GCC v14 I get the following:

> gcc -m64 -Wall -Wmissing-prototypes -Wpointer-arith
> -Wdeclaration-after-statement -Werror=vla -Wendif-labels
> -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type
> -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv
> -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation
> -O2 -I../../../src/include  -D_POSIX_PTHREAD_SEMANTICS
> -I/usr/include/libxml2   -c -o auth.o auth.c
> auth.c:101:9: error: initialization of 'int (*)(int,  struct pam_message **,
> struct pam_response **, void *)' from incompatible pointer type 'int
> (*)(int,  const struct pam_message **, struct pam_response **, void *)'
> [-Wincompatible-pointer-types]
>   101 |         &pam_passwd_conv_proc,
>       |         ^
> auth.c:101:9: note: (near initialization for 'pam_passw_conv.conv')

This doesn't look like a GCC version problem, but like a discrepancy
in the PAM header files, to wit, "const" or not in the expected
signature of pam_passwd_conv_proc.  Can you verify whether or not
pam_appl.h and its subsidiary headers changed?

On my Linux box I find this in /usr/include/security/_pam_types.h:

struct pam_conv {
    int (*conv)(int num_msg, const struct pam_message **msg,
		struct pam_response **resp, void *appdata_ptr);
    void *appdata_ptr;
};

but it seems that "const" is missing in yours.  I guess an alternative
theory is that it was inconsistent all along but you hadn't previously
tried to build --with-pam.

			regards, tom lane





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

* Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message
@ 2025-07-23 14:44  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 8+ messages in thread

From: Tom Lane @ 2025-07-23 14:44 UTC (permalink / raw)
  To: awatkins1966@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

I wrote:
> This doesn't look like a GCC version problem, but like a discrepancy
> in the PAM header files, to wit, "const" or not in the expected
> signature of pam_passwd_conv_proc.  Can you verify whether or not
> pam_appl.h and its subsidiary headers changed?

I had a feeling we'd seen this before, and after digging in the
archives indeed we have:

https://www.postgresql.org/message-id/flat/16415.1184285944%40sss.pgh.pa.us#a0a2fac693665cc517f761e2...

So I take back the guess that it's not about GCC version.  What
seems more likely now is that it's been a warning right along,
which you have been ignoring, and GCC 14 has decided to promote
it to an error.

We could perhaps install a configure check to see if this argument
is expected to be const or not.  But given the shortage of reports,
I think it'd be sufficient to do what I suggested in that 2007
thread:

>> The main issue in my mind would be how to determine whether to use
>> const or not.  If all Solaris releases are like this, and can be
>> expected to stay that way, I'd be inclined to just put a "#define
>> PAM_CONV_PROC_NOT_CONST" in include/port/solaris.h and drive the
>> function declaration off that.

As a short-term workaround, GCC has probably got a command-line
option to knock the error back down to a warning.

			regards, tom lane





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

* Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message
@ 2025-07-23 15:31  Andrew Watkins <awatkins1966@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 2 replies; 8+ messages in thread

From: Andrew Watkins @ 2025-07-23 15:31 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org

>
>
>
> On my Linux box I find this in /usr/include/security/_pam_types.h:
>
> struct pam_conv {
>     int (*conv)(int num_msg, const struct pam_message **msg,
>                 struct pam_response **resp, void *appdata_ptr);
>     void *appdata_ptr;
> };


 You are right Solaris is missing "const"

struct pam_conv {
        int (*conv)(int, struct pam_message **, struct pam_response **,
void *);
        void *appdata_ptr;
};

Sorry, for digging up an old problem . I did some searching of the archive
but never found that link going back to 2007.

Now with your pointer I can see Oracle Solaris get over this problem by
patching source code of software. Guess they can't afford to fix
the  pam_appl.h file.

Thanks
Andrew

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

* Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message
@ 2025-07-23 15:43  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Andrew Watkins <awatkins1966@gmail.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Tom Lane @ 2025-07-23 15:43 UTC (permalink / raw)
  To: Andrew Watkins <awatkins1966@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

Andrew Watkins <awatkins1966@gmail.com> writes:
> Sorry, for digging up an old problem . I did some searching of the archive
> but never found that link going back to 2007.

No trouble.  I'm surprised we never did anything about it, TBH.

Reviewing our buildfarm members, it looks like none of the current
Solaris or illumos/OpenIndiana animals use --with-pam, which is a
bit sad but explains why we don't see any warnings in the farm.
And I guess end users have just ignored the warning so far.
But we'll have to up our game if GCC is going to start making this
an error by default.

			regards, tom lane





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

* Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message
@ 2025-07-23 18:41  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Andrew Watkins <awatkins1966@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Tom Lane @ 2025-07-23 18:41 UTC (permalink / raw)
  To: Andrew Watkins <awatkins1966@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

Andrew Watkins <awatkins1966@gmail.com> writes:
>  You are right Solaris is missing "const"

> struct pam_conv {
>         int (*conv)(int, struct pam_message **, struct pam_response **,
> void *);
>         void *appdata_ptr;
> };

So I tried to replicate this issue on an OpenIndiana VM (OI 2024.04),
and got no failure.  Digging into /usr/include/security/pam_appl.h,
I found the reason:

struct pam_conv {
#ifdef _PAM_LEGACY_NONCONST
        int (*conv)(int, struct pam_message **,
#else
        int (*conv)(int, const struct pam_message **,
#endif
            struct pam_response **, void *);
        void *appdata_ptr;              /* Application data ptr */
};

So that's just annoying as all get-out: it means some "Solaris"
platforms do have this declaration with the "const", and even
there it's going to be dependent on compilation environment.

I still see a way to avoid a configure check though: let's make
src/include/port/solaris.h "#define _PAM_LEGACY_NONCONST".
That should make OpenIndiana enough like other Solaris-alikes
for the purpose, and we can also use that same symbol to cue
our code how to declare the callback function.

Or we could create a configure check, but that seems like a lot
of work, and it would add some extra time to everybody's build.

			regards, tom lane





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

* Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message
@ 2025-07-23 19:47  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2025-07-23 19:47 UTC (permalink / raw)
  To: Andrew Watkins <awatkins1966@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

I wrote:
> I still see a way to avoid a configure check though: let's make
> src/include/port/solaris.h "#define _PAM_LEGACY_NONCONST".
> That should make OpenIndiana enough like other Solaris-alikes
> for the purpose, and we can also use that same symbol to cue
> our code how to declare the callback function.

Done that way at

https://git.postgresql.org/gitweb/?p=postgresql.git;a=patch;h=635a856279ef55074dfc7a2a96c7fd686b5ff0...

If you can confirm that you get a clean build with this patch,
I'd appreciate it.

			regards, tom lane





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

* Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message
@ 2025-07-24 10:28  Andrew Watkins <awatkins1966@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 8+ messages in thread

From: Andrew Watkins @ 2025-07-24 10:28 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org

>
>
> Done that way at
>
>
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=patch;h=635a856279ef55074dfc7a2a96c7fd686b5ff0...
>
> If you can confirm that you get a clean build with this patch,
> I'd appreciate it.
>
> I can confirm the build was a success with the above patch.
Thanks :-)
Andrew

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


end of thread, other threads:[~2025-07-24 10:28 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-23 10:00 BUG #18995: Building with GCC 14 fails:  incompatible pointer struct pam_message PG Bug reporting form <noreply@postgresql.org>
2025-07-23 14:27 ` Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message Tom Lane <tgl@sss.pgh.pa.us>
2025-07-23 14:44   ` Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message Tom Lane <tgl@sss.pgh.pa.us>
2025-07-23 15:31   ` Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message Andrew Watkins <awatkins1966@gmail.com>
2025-07-23 15:43     ` Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message Tom Lane <tgl@sss.pgh.pa.us>
2025-07-23 18:41     ` Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message Tom Lane <tgl@sss.pgh.pa.us>
2025-07-23 19:47       ` Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message Tom Lane <tgl@sss.pgh.pa.us>
2025-07-24 10:28         ` Re: BUG #18995: Building with GCC 14 fails: incompatible pointer struct pam_message Andrew Watkins <awatkins1966@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox