Re: Request for portability test of strerror().

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Pete Forman <gsez020(at)kryten(dot)bedford(dot)waii(dot)com>
Cc: pgsql-ports(at)postgresql(dot)org
Subject: Re: Request for portability test of strerror().
Date: 2000-10-20 14:17:12
Message-ID: 200010201417.KAA08665@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports

Pete, can you handle coversion of fprintf(stderr) to elog at the same
time? It would be nice, but it can only be done in places where elog is
safe.

Content-Description: message body text

> I'm preparing a patch for backend/utils/error to make the printing of
> error messages more robust. It would be very helpful if people on
> different systems would compile and run the following test program to
> check the behaviour of strerror().
>
> The PostgreSQL code is called only in exceptional circumstances, so
> regular testing of my changes is not possible.
>
> According to the standards UNIX95 (aka XPG4v2) and later, strerror()
> should set errno to EINVAL if its argument is out of range. Most
> compliant systems seem to return a default string with a number
> printed in it and so never set errno.
>
> sys_nerr was last in XPG2 but has now been dropped. I'm hoping to
> remove it from the PostgreSQL code.
>
Content-Description: Test behaviour of strerror()

[ Attachment, skipping... ]
Content-Description: message body and .signature

>
> My results so far follow. I've listed them by OS though there is also
> a dependency on libc.
>
> AIX 4.3: errno = 0 after strerror(-1) returned "Error -1 occurred."
> Cygwin B20: errno = 0 after strerror(-1) returned "error -1"
> IRIX 6.5: errno = 0 after strerror(-1) returned NULL
> Redhat 6.2: errno = 0 after strerror(-1) returned "Unknown error 4294967295"
> Solaris 2.6: errno = 0 after strerror(-1) returned NULL
> Solaris 7: errno = 0 after strerror(-1) returned NULL
>
>
> What I'd like to know is whether any version of strerror() returns a
> non-NULL pointer that does not contain a print of the number.
> --
> Pete Forman -./\.- Disclaimer: This post is originated
> Western Geophysical -./\.- by myself and does not represent
> pete(dot)forman(at)westgeo(dot)com -./\.- the opinion of Baker Hughes or
> http://www.crosswinds.net/~petef -./\.- its divisions.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-ports by date

  From Date Subject
Next Message Pawel Wegrzyn 2000-10-21 13:04:12 latest version?
Previous Message Jason Tishler 2000-10-20 13:17:10 Re: Request for portability test of strerror().