From: | Pete Forman <gsez020(at)kryten(dot)bedford(dot)waii(dot)com> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Subject: | Improved fix for sys_nerr |
Date: | 2000-10-26 09:25:31 |
Message-ID: | 14839.63627.58567.35604@kryten.bedford.waii.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Pete Forman
Your email address : pete(dot)forman(at)westgeo(dot)com
System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium II
Operating System (example: Linux 2.0.26 ELF) : Cygwin B20.1 and others
PostgreSQL version (example: PostgreSQL-7.1): PostgreSQL-7.1
Compiler used (example: gcc 2.8.0) : egcs-2.91.57
Please enter a FULL description of your problem:
------------------------------------------------
Files backend/utils/error/elog.c and exc.c had errors building on
Cygwin B20.1 (and BeOS so I'm told). The current source (elog.c,v
1.64, exc.c,v 1.31) is fixed for Cygwin 1.1 and BeOS but not very
robustly. This patch works on the systems and versions I've tested.
Others were tested by subscribers to PORTS.
The changes made are:
1) Remove declarations of "extern int errno;".
- errno does not have to be an int, it may be a macro. In
threaded code it almost certainly will be the latter.
<errno.h> will already have the correct declaration.
2) Remove sys_nerr and _sys_nerr.
- These are not portable, e.g. older Cygwin and BeOS.
In any case the test errno < sys_nerr assumes that valid
errnos are contiguous. strerror() may go wrong on holes.
3) Test both errno and the return of strerror() to see if it fails.
- This works an all(?) OSs except HPUX and QNX. These then have
a minor limitation that if the elog() is called with an out of
range errno then its number will not be printed. I would
expect that it would be called with a valid errno.
In exc.c both the errno and its message, if available, are now
printed.
I leave it to the user to call elog(..., "%d: %m", errno, ...)
if they want to guarantee a number.
Anything more complicated will need to involve configure. I
am loathe to do so because this sort of error code is called
infrequently and will only be tested lightly. Keep it
simple.
4) Remove any OS specific clauses: ifdef __CYGWIN__ or __BEOS__.
I have posted an equivalent patch to PORTS for 7.0.2.
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 3.3 KB |
unknown_filename | text/plain | 276 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2000-10-26 14:59:20 | Re: readline and openbsd |
Previous Message | Bruce Momjian | 2000-10-26 06:16:27 | Re: minor doc patchu |