[MacPorts] #71355: postgresql16 @16.4_1 does not build on PPC Tiger, Mac OS X 10.4.11, because of "Extraneous text after `else' directive"
MacPorts
noreply at macports.org
Tue Nov 19 14:56:47 UTC 2024
#71355: postgresql16 @16.4_1 does not build on PPC Tiger, Mac OS X 10.4.11, because
of "Extraneous text after `else' directive"
---------------------------+-----------------------
Reporter: ballapete | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.10.4
Resolution: | Keywords: tiger ppc
Port: postgresql16 |
---------------------------+-----------------------
Comment (by ballapete):
I cannot decide what to patch…
fd.c receives
{{{
# 79 "../../../../src/include/access/xlogdefs.h"
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
}}}
and has the faulty macro herein:
{{{
1046 /*
1047 * BasicOpenFilePerm --- same as open(2) except can free other FDs
if needed
1048 *
1049 * This is exported for use by places that really want a plain
kernel FD,
1050 * but need to be proof against running out of FDs. Once an FD
has been
1051 * successfully returned, it is the caller's responsibility to
ensure that
1052 * it will not be leaked on ereport()! Most users should *not*
call this
1053 * routine directly, but instead use the VFD abstraction level,
which
1054 * provides protection against descriptor leaks as well as
management of
1055 * files that need to be open for more than a short period of
time.
1056 *
1057 * Ideally this should be the *only* direct call of open() in the
backend.
1058 * In practice, the postmaster calls open() directly, and there
are some
1059 * direct open() calls done early in backend startup. Those are
OK since
1060 * this module wouldn't have any open files to close at that point
anyway.
1061 */
1062 int
1063 BasicOpenFilePerm(const char *fileName, int fileFlags, mode_t
fileMode)
1064 {
1065 int fd;
1066
1067 tryAgain:
1068 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1069
1070 /*
1071 * The value we defined to stand in for O_DIRECT when
simulating it with
1072 * F_NOCACHE had better not collide with any of the
standard flags.
1073 */
1074 StaticAssertStmt((PG_O_DIRECT &
1075 (O_APPEND |
1076 O_CLOEXEC |
1077 O_CREAT |
1078 O_DSYNC |
1079 O_EXCL |
1080 O_RDWR |
1081 O_RDONLY |
1082 O_SYNC |
1083 O_TRUNC |
1084 O_WRONLY)) == 0,
1085 "PG_O_DIRECT value
collides with standard flag");
1086 fd = open(fileName, fileFlags & ~PG_O_DIRECT, fileMode);
1087 #else
1088 fd = open(fileName, fileFlags, fileMode);
1089 #endif
1090
1091 if (fd >= 0)
1092 {
1093 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1094 if (fileFlags & PG_O_DIRECT)
1095 {
1096 if (fcntl(fd, F_NOCACHE, 1) < 0)
1097 {
1098 int save_errno
= errno;
1099
1100 close(fd);
1101 errno = save_errno;
1102 return -1;
1103 }
1104 }
1105 #endif
1106
1107 return fd; /*
success! */
1108 }
1109
1110 if (errno == EMFILE || errno == ENFILE)
1111 {
1112 int save_errno = errno;
1113
1114 ereport(LOG,
1115
(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1116 errmsg("out of file descriptors:
%m; release and retry")));
1117 errno = 0;
1118 if (ReleaseLruFile())
1119 goto tryAgain;
1120 errno = save_errno;
1121 }
1122
1123 return -1; /* failure
*/
1124 }
}}}
which gets expanded by the C pre-processor to this:
{{{
# 1062 "fd.c"
int
BasicOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode)
{
int fd;
tryAgain:
((void) sizeof(struct { int static_assert_failure : ((0x80000000 &
(0x0008 | 0 | 0x0200 | O_DSYNC | 0x0800 | 0x0002 | 0x0000 | 0x0080 |
0x0400 | 0x0001)) == 0) ? 1 : -1; }));
# 1086 "fd.c"
fd = open(fileName, fileFlags & ~0x80000000, fileMode);
}}}
OSYNC is #define'd as 0x0080, which is already used in the statement
above, so it could as well be simply removed on line #1078 – is this an
acceptable solution? Best would be to put this line into a guard that only
when __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1040 includes O_DSYNC
into the OR expression…
--
Ticket URL: <https://trac.macports.org/ticket/71355#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list