Thread: Remove support for old realpath() API

Remove support for old realpath() API

From
Peter Eisentraut
Date:
The now preferred way to call realpath() is by passing NULL as the
second argument and get a malloc'ed result.  We still supported the
old way of providing our own buffer as a second argument, for some
platforms that didn't support the new way yet.  Those were only
Solaris less than version 11 and some older AIX versions (7.1 and
newer appear to support the new variant).  We don't support those
platforms versions anymore, so we can remove this extra code.
Attachment

Re: Remove support for old realpath() API

From
Heikki Linnakangas
Date:
On 05/08/2024 09:12, Peter Eisentraut wrote:
> The now preferred way to call realpath() is by passing NULL as the
> second argument and get a malloc'ed result.  We still supported the
> old way of providing our own buffer as a second argument, for some
> platforms that didn't support the new way yet.  Those were only
> Solaris less than version 11 and some older AIX versions (7.1 and
> newer appear to support the new variant).  We don't support those
> platforms versions anymore, so we can remove this extra code.

+1

We don't seem to have any mentions of POSIX or SuS in docs, in the 
installation sections. There are a few mentions of POSIX-1.2008 and 
POSIX-1.2001 it in the commit log, though, where we require features 
specified by those. Can we rely on everything from POSIX-1-2008 
nowadays, or is it more on a case-by-case basis, depending on which 
parts of POSIX are supported by various platforms?

-- 
Heikki Linnakangas
Neon (https://neon.tech)




Re: Remove support for old realpath() API

From
Tom Lane
Date:
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> We don't seem to have any mentions of POSIX or SuS in docs, in the 
> installation sections. There are a few mentions of POSIX-1.2008 and 
> POSIX-1.2001 it in the commit log, though, where we require features 
> specified by those. Can we rely on everything from POSIX-1-2008 
> nowadays, or is it more on a case-by-case basis, depending on which 
> parts of POSIX are supported by various platforms?

I'd say it's still case-by-case.  Perhaps everything in POSIX-1.2008
is supported now on every platform we care about, but perhaps not.

            regards, tom lane



Re: Remove support for old realpath() API

From
Michael Paquier
Date:
On Mon, Aug 05, 2024 at 10:08:04AM -0400, Tom Lane wrote:
> Heikki Linnakangas <hlinnaka@iki.fi> writes:
>> We don't seem to have any mentions of POSIX or SuS in docs, in the
>> installation sections. There are a few mentions of POSIX-1.2008 and
>> POSIX-1.2001 it in the commit log, though, where we require features
>> specified by those. Can we rely on everything from POSIX-1-2008
>> nowadays, or is it more on a case-by-case basis, depending on which
>> parts of POSIX are supported by various platforms?
>
> I'd say it's still case-by-case.  Perhaps everything in POSIX-1.2008
> is supported now on every platform we care about, but perhaps not.

Just pointing at the message where this has been discussed previously,
for reference:
https://www.postgresql.org/message-id/1457809.1662232534@sss.pgh.pa.us

Leaving Solaris aside because there is nothing older than 11 in the
buildfarm currently, I am dubious that it is a good idea to remove
this code knowing that we have a thread from a few months ago about
the fact that we have folks complaining about AIX support and that we
should bring it back:
https://www.postgresql.org/message-id/CY5PR11MB63928CC05906F27FB10D74D0FD322@CY5PR11MB6392.namprd11.prod.outlook.com
--
Michael

Attachment

Re: Remove support for old realpath() API

From
Daniel Gustafsson
Date:
> On 6 Aug 2024, at 07:43, Michael Paquier <michael@paquier.xyz> wrote:

> I am dubious that it is a good idea to remove
> this code knowing that we have a thread from a few months ago about
> the fact that we have folks complaining about AIX support and that we
> should bring it back:

According to upthread it is supported since AIX 7.1 which shipped in 2010 so
even if support materializes for AIX it still wouldn't be needed.

--
Daniel Gustafsson




Re: Remove support for old realpath() API

From
Peter Eisentraut
Date:
On 05.08.24 09:41, Heikki Linnakangas wrote:
> On 05/08/2024 09:12, Peter Eisentraut wrote:
>> The now preferred way to call realpath() is by passing NULL as the
>> second argument and get a malloc'ed result.  We still supported the
>> old way of providing our own buffer as a second argument, for some
>> platforms that didn't support the new way yet.  Those were only
>> Solaris less than version 11 and some older AIX versions (7.1 and
>> newer appear to support the new variant).  We don't support those
>> platforms versions anymore, so we can remove this extra code.
> 
> +1

committed




Re: Remove support for old realpath() API

From
Thomas Munro
Date:
On Mon, Aug 12, 2024 at 6:18 PM Peter Eisentraut <peter@eisentraut.org> wrote:
> On 05.08.24 09:41, Heikki Linnakangas wrote:
> > On 05/08/2024 09:12, Peter Eisentraut wrote:
> >> The now preferred way to call realpath() is by passing NULL as the
> >> second argument and get a malloc'ed result.  We still supported the
> >> old way of providing our own buffer as a second argument, for some
> >> platforms that didn't support the new way yet.  Those were only
> >> Solaris less than version 11 and some older AIX versions (7.1 and
> >> newer appear to support the new variant).  We don't support those
> >> platforms versions anymore, so we can remove this extra code.

I checked this in the AIX 7.3 manual and the POSIX 2008 way does not
appear to be mentioned there:

https://www.ibm.com/docs/en/aix/7.3?topic=r-realpath-subroutine

That's a bit confusing, or maybe there are just too many versioning
systems to keep track of and I've made a mistake, because it looks
like AIX 7.2.5+ has actual certification for Unix V7 AKA SUSv4 AKA
POSIX 2008...  Or maybe the documentation is wrong and it does
actually work.  I guess the IBM crew will be forced to look into this
as they continue to work on their PostgreSQL/AIX patch, if it doesn't
work...



Re: Remove support for old realpath() API

From
Peter Eisentraut
Date:
On 12.08.24 08:47, Thomas Munro wrote:
> On Mon, Aug 12, 2024 at 6:18 PM Peter Eisentraut <peter@eisentraut.org> wrote:
>> On 05.08.24 09:41, Heikki Linnakangas wrote:
>>> On 05/08/2024 09:12, Peter Eisentraut wrote:
>>>> The now preferred way to call realpath() is by passing NULL as the
>>>> second argument and get a malloc'ed result.  We still supported the
>>>> old way of providing our own buffer as a second argument, for some
>>>> platforms that didn't support the new way yet.  Those were only
>>>> Solaris less than version 11 and some older AIX versions (7.1 and
>>>> newer appear to support the new variant).  We don't support those
>>>> platforms versions anymore, so we can remove this extra code.
> 
> I checked this in the AIX 7.3 manual and the POSIX 2008 way does not
> appear to be mentioned there:
> 
> https://www.ibm.com/docs/en/aix/7.3?topic=r-realpath-subroutine
> 
> That's a bit confusing, or maybe there are just too many versioning
> systems to keep track of and I've made a mistake, because it looks
> like AIX 7.2.5+ has actual certification for Unix V7 AKA SUSv4 AKA
> POSIX 2008...  Or maybe the documentation is wrong and it does
> actually work.  I guess the IBM crew will be forced to look into this
> as they continue to work on their PostgreSQL/AIX patch, if it doesn't
> work...

Tom had tested this on and found that it does actually work on AIX 7.1 
and 7.3 but the documentation is wrong.




Re: Remove support for old realpath() API

From
Tom Lane
Date:
Peter Eisentraut <peter@eisentraut.org> writes:
> On 12.08.24 08:47, Thomas Munro wrote:
>> I checked this in the AIX 7.3 manual and the POSIX 2008 way does not
>> appear to be mentioned there:
>> https://www.ibm.com/docs/en/aix/7.3?topic=r-realpath-subroutine

> Tom had tested this on and found that it does actually work on AIX 7.1 
> and 7.3 but the documentation is wrong.

I too have a distinct recollection of having tested this (using the
gcc compile farm machines), but I cannot find anything saying so in
the mailing list archives.  I can go check it again, I guess.

            regards, tom lane



Re: Remove support for old realpath() API

From
Tom Lane
Date:
I wrote:
> Peter Eisentraut <peter@eisentraut.org> writes:
>> Tom had tested this on and found that it does actually work on AIX 7.1 
>> and 7.3 but the documentation is wrong.

> I too have a distinct recollection of having tested this (using the
> gcc compile farm machines), but I cannot find anything saying so in
> the mailing list archives.  I can go check it again, I guess.

I can confirm that the attached program works on cfarm111 (AIX 7.1)
and cfarm119 (AIX 7.3), though "man realpath" denies it on both
systems.

I also found leftover test files demonstrating that I checked this
same point on Apr 26 2024, so I'm not sure why that didn't turn up
in a mail list search.

            regards, tom lane

#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char **argv)
{
    char *pth = realpath(argv[1], NULL);

    if (pth)
    {
        printf("successfully resolved \"%s\" as \"%s\"\n",
               argv[1], pth);
        free(pth);
    }
    else
        perror("realpath");
    return 0;
}

Re: Remove support for old realpath() API

From
Thomas Munro
Date:
On Tue, Aug 13, 2024 at 2:35 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I can confirm that the attached program works on cfarm111 (AIX 7.1)
> and cfarm119 (AIX 7.3), though "man realpath" denies it on both
> systems.

Another example of this phenomenon: they have nl_langinfo_l(), a POSIX
2008 feature we want in a nearby thread, but the online documentation
and man pages also deny that.