Thread: Patchless postgres 8.x on AIX

Patchless postgres 8.x on AIX

From
Seneca Cunningham
Date:
I have patchless postgres 8.x working to the extent that it's not
segfaulting on AIX 5.3 here, ML3 and built with gcc 4.0.1.  There are
two different ways that I've done it, adding "-lc" to the LDFLAGS passed
to configure, and passing "--without-readline" to configure.  All 98
regression tests pass with "--without-readline", but the inet test fails
when LDFLAGS is set to "-lc".

What is happening with postgres certainly appears to be related to the
linker; in dynahash.c, the keycopy functions that work with no new
linker flags (strncpy, memmove worked as a memcpy replacement) are all
exported by libreadline.a, while the segfaulting/infinite-looping memcpy
is not.  When all the keycopy functions are from libc.a, by not linking
against libreadline or by telling the linker to first check libc, all
the keycopy functions, including memcpy, work.

LDFLAGS configuration
$ LDFLAGS="-lc" ./configure \
   --prefix=/opt/dbs/pgsql810-afilias-AIX53-2005-11-16 \
   --with-includes=/opt/freeware/include --enable-debug \
   --enable-thread-safety --with-libraries=/opt/freeware/lib \
   --enable-casert

no readline configuration
$ ./configure --prefix=/opt/dbs/pgsql810-afilias-AIX53-2005-11-16 \
   --with-includes=/opt/freeware/include --enable-debug \
   --enable-thread-safety --with-libraries=/opt/freeware/lib \
   --enable-casert --without-readline

--
Seneca Cunningham
scunning@ca.afilias.info
*** ./expected/inet.out    Fri Oct  8 01:45:37 2004
--- ./results/inet.out    Wed Nov 16 22:04:27 2005
***************
*** 20,27 ****
--- 20,30 ----
  INSERT INTO INET_TBL (c, i) VALUES ('10', '11.1.2.3/8');
  INSERT INTO INET_TBL (c, i) VALUES ('10', '9.1.2.3/8');
  INSERT INTO INET_TBL (c, i) VALUES ('10:23::f1', '10:23::f1/64');
+ ERROR:  invalid input syntax for type cidr: "10:23::f1"
  INSERT INTO INET_TBL (c, i) VALUES ('10:23::8000/113', '10:23::ffff');
+ ERROR:  invalid input syntax for type cidr: "10:23::8000/113"
  INSERT INTO INET_TBL (c, i) VALUES ('::ffff:1.2.3.4', '::4.3.2.1/24');
+ ERROR:  invalid input syntax for type cidr: "::ffff:1.2.3.4"
  -- check that CIDR rejects invalid input:
  INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/30', '192.168.1.226');
  ERROR:  invalid cidr value: "192.168.1.2/30"
***************
*** 33,171 ****
  ERROR:  invalid cidr value: "192.168.1.2/30"
  DETAIL:  Value has bits set to right of mask.
  INSERT INTO INET_TBL (c, i) VALUES (cidr('ffff:ffff:ffff:ffff::/24'), '::192.168.1.226');
! ERROR:  invalid cidr value: "ffff:ffff:ffff:ffff::/24"
! DETAIL:  Value has bits set to right of mask.
  SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL;
   ten |        cidr        |       inet
! -----+--------------------+------------------
!      | 192.168.1.0/24     | 192.168.1.226/24
!      | 192.168.1.0/26     | 192.168.1.226
!      | 192.168.1.0/24     | 192.168.1.0/24
!      | 192.168.1.0/24     | 192.168.1.0/25
!      | 192.168.1.0/24     | 192.168.1.255/24
!      | 192.168.1.0/24     | 192.168.1.255/25
!      | 10.0.0.0/8         | 10.1.2.3/8
!      | 10.0.0.0/32        | 10.1.2.3/8
!      | 10.1.2.3/32        | 10.1.2.3
!      | 10.1.2.0/24        | 10.1.2.3/24
!      | 10.1.0.0/16        | 10.1.2.3/16
!      | 10.0.0.0/8         | 10.1.2.3/8
!      | 10.0.0.0/8         | 11.1.2.3/8
!      | 10.0.0.0/8         | 9.1.2.3/8
!      | 10:23::f1/128      | 10:23::f1/64
!      | 10:23::8000/113    | 10:23::ffff
!      | ::ffff:1.2.3.4/128 | ::4.3.2.1/24
! (17 rows)

  -- now test some support functions
  SELECT '' AS ten, i AS inet, host(i), text(i), family(i) FROM INET_TBL;
   ten |       inet       |     host      |       text       | family
  -----+------------------+---------------+------------------+--------
!      | 192.168.1.226/24 | 192.168.1.226 | 192.168.1.226/24 |      4
!      | 192.168.1.226    | 192.168.1.226 | 192.168.1.226/32 |      4
!      | 192.168.1.0/24   | 192.168.1.0   | 192.168.1.0/24   |      4
!      | 192.168.1.0/25   | 192.168.1.0   | 192.168.1.0/25   |      4
!      | 192.168.1.255/24 | 192.168.1.255 | 192.168.1.255/24 |      4
!      | 192.168.1.255/25 | 192.168.1.255 | 192.168.1.255/25 |      4
!      | 10.1.2.3/8       | 10.1.2.3      | 10.1.2.3/8       |      4
!      | 10.1.2.3/8       | 10.1.2.3      | 10.1.2.3/8       |      4
!      | 10.1.2.3         | 10.1.2.3      | 10.1.2.3/32      |      4
!      | 10.1.2.3/24      | 10.1.2.3      | 10.1.2.3/24      |      4
!      | 10.1.2.3/16      | 10.1.2.3      | 10.1.2.3/16      |      4
!      | 10.1.2.3/8       | 10.1.2.3      | 10.1.2.3/8       |      4
!      | 11.1.2.3/8       | 11.1.2.3      | 11.1.2.3/8       |      4
!      | 9.1.2.3/8        | 9.1.2.3       | 9.1.2.3/8        |      4
!      | 10:23::f1/64     | 10:23::f1     | 10:23::f1/64     |      6
!      | 10:23::ffff      | 10:23::ffff   | 10:23::ffff/128  |      6
!      | ::4.3.2.1/24     | ::4.3.2.1     | ::4.3.2.1/24     |      6
! (17 rows)

  SELECT '' AS ten, c AS cidr, broadcast(c),
    i AS inet, broadcast(i) FROM INET_TBL;
   ten |        cidr        |    broadcast     |       inet       |               broadcast
! -----+--------------------+------------------+------------------+---------------------------------------
!      | 192.168.1.0/24     | 192.168.1.255/24 | 192.168.1.226/24 | 192.168.1.255/24
!      | 192.168.1.0/26     | 192.168.1.63/26  | 192.168.1.226    | 192.168.1.226
!      | 192.168.1.0/24     | 192.168.1.255/24 | 192.168.1.0/24   | 192.168.1.255/24
!      | 192.168.1.0/24     | 192.168.1.255/24 | 192.168.1.0/25   | 192.168.1.127/25
!      | 192.168.1.0/24     | 192.168.1.255/24 | 192.168.1.255/24 | 192.168.1.255/24
!      | 192.168.1.0/24     | 192.168.1.255/24 | 192.168.1.255/25 | 192.168.1.255/25
!      | 10.0.0.0/8         | 10.255.255.255/8 | 10.1.2.3/8       | 10.255.255.255/8
!      | 10.0.0.0/32        | 10.0.0.0         | 10.1.2.3/8       | 10.255.255.255/8
!      | 10.1.2.3/32        | 10.1.2.3         | 10.1.2.3         | 10.1.2.3
!      | 10.1.2.0/24        | 10.1.2.255/24    | 10.1.2.3/24      | 10.1.2.255/24
!      | 10.1.0.0/16        | 10.1.255.255/16  | 10.1.2.3/16      | 10.1.255.255/16
!      | 10.0.0.0/8         | 10.255.255.255/8 | 10.1.2.3/8       | 10.255.255.255/8
!      | 10.0.0.0/8         | 10.255.255.255/8 | 11.1.2.3/8       | 11.255.255.255/8
!      | 10.0.0.0/8         | 10.255.255.255/8 | 9.1.2.3/8        | 9.255.255.255/8
!      | 10:23::f1/128      | 10:23::f1        | 10:23::f1/64     | 10:23::ffff:ffff:ffff:ffff/64
!      | 10:23::8000/113    | 10:23::ffff/113  | 10:23::ffff      | 10:23::ffff
!      | ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4   | ::4.3.2.1/24     | 0:ff:ffff:ffff:ffff:ffff:ffff:ffff/24
! (17 rows)

  SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)",
    i AS inet, network(i) AS "network(inet)" FROM INET_TBL;
   ten |        cidr        |   network(cidr)    |       inet       |  network(inet)
! -----+--------------------+--------------------+------------------+------------------
!      | 192.168.1.0/24     | 192.168.1.0/24     | 192.168.1.226/24 | 192.168.1.0/24
!      | 192.168.1.0/26     | 192.168.1.0/26     | 192.168.1.226    | 192.168.1.226/32
!      | 192.168.1.0/24     | 192.168.1.0/24     | 192.168.1.0/24   | 192.168.1.0/24
!      | 192.168.1.0/24     | 192.168.1.0/24     | 192.168.1.0/25   | 192.168.1.0/25
!      | 192.168.1.0/24     | 192.168.1.0/24     | 192.168.1.255/24 | 192.168.1.0/24
!      | 192.168.1.0/24     | 192.168.1.0/24     | 192.168.1.255/25 | 192.168.1.128/25
!      | 10.0.0.0/8         | 10.0.0.0/8         | 10.1.2.3/8       | 10.0.0.0/8
!      | 10.0.0.0/32        | 10.0.0.0/32        | 10.1.2.3/8       | 10.0.0.0/8
!      | 10.1.2.3/32        | 10.1.2.3/32        | 10.1.2.3         | 10.1.2.3/32
!      | 10.1.2.0/24        | 10.1.2.0/24        | 10.1.2.3/24      | 10.1.2.0/24
!      | 10.1.0.0/16        | 10.1.0.0/16        | 10.1.2.3/16      | 10.1.0.0/16
!      | 10.0.0.0/8         | 10.0.0.0/8         | 10.1.2.3/8       | 10.0.0.0/8
!      | 10.0.0.0/8         | 10.0.0.0/8         | 11.1.2.3/8       | 11.0.0.0/8
!      | 10.0.0.0/8         | 10.0.0.0/8         | 9.1.2.3/8        | 9.0.0.0/8
!      | 10:23::f1/128      | 10:23::f1/128      | 10:23::f1/64     | 10:23::/64
!      | 10:23::8000/113    | 10:23::8000/113    | 10:23::ffff      | 10:23::ffff/128
!      | ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4/128 | ::4.3.2.1/24     | ::/24
! (17 rows)

  SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)",
    i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL;
   ten |        cidr        | masklen(cidr) |       inet       | masklen(inet)
! -----+--------------------+---------------+------------------+---------------
!      | 192.168.1.0/24     |            24 | 192.168.1.226/24 |            24
!      | 192.168.1.0/26     |            26 | 192.168.1.226    |            32
!      | 192.168.1.0/24     |            24 | 192.168.1.0/24   |            24
!      | 192.168.1.0/24     |            24 | 192.168.1.0/25   |            25
!      | 192.168.1.0/24     |            24 | 192.168.1.255/24 |            24
!      | 192.168.1.0/24     |            24 | 192.168.1.255/25 |            25
!      | 10.0.0.0/8         |             8 | 10.1.2.3/8       |             8
!      | 10.0.0.0/32        |            32 | 10.1.2.3/8       |             8
!      | 10.1.2.3/32        |            32 | 10.1.2.3         |            32
!      | 10.1.2.0/24        |            24 | 10.1.2.3/24      |            24
!      | 10.1.0.0/16        |            16 | 10.1.2.3/16      |            16
!      | 10.0.0.0/8         |             8 | 10.1.2.3/8       |             8
!      | 10.0.0.0/8         |             8 | 11.1.2.3/8       |             8
!      | 10.0.0.0/8         |             8 | 9.1.2.3/8        |             8
!      | 10:23::f1/128      |           128 | 10:23::f1/64     |            64
!      | 10:23::8000/113    |           113 | 10:23::ffff      |           128
!      | ::ffff:1.2.3.4/128 |           128 | ::4.3.2.1/24     |            24
! (17 rows)

  SELECT '' AS four, c AS cidr, masklen(c) AS "masklen(cidr)",
    i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL
    WHERE masklen(c) <= 8;
   four |    cidr    | masklen(cidr) |    inet    | masklen(inet)
! ------+------------+---------------+------------+---------------
!       | 10.0.0.0/8 |             8 | 10.1.2.3/8 |             8
!       | 10.0.0.0/8 |             8 | 10.1.2.3/8 |             8
!       | 10.0.0.0/8 |             8 | 11.1.2.3/8 |             8
!       | 10.0.0.0/8 |             8 | 9.1.2.3/8  |             8
  (4 rows)

  SELECT '' AS six, c AS cidr, i AS inet FROM INET_TBL
    WHERE c = i;
   six |      cidr      |      inet
! -----+----------------+----------------
!      | 192.168.1.0/24 | 192.168.1.0/24
!      | 10.1.2.3/32    | 10.1.2.3
  (2 rows)

  SELECT '' AS ten, i, c,
--- 36,158 ----
  ERROR:  invalid cidr value: "192.168.1.2/30"
  DETAIL:  Value has bits set to right of mask.
  INSERT INTO INET_TBL (c, i) VALUES (cidr('ffff:ffff:ffff:ffff::/24'), '::192.168.1.226');
! ERROR:  invalid input syntax for type cidr: "ffff:ffff:ffff:ffff::/24"
  SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL;
   ten |      cidr      |       inet
! -----+----------------+------------------
!      | 192.168.1/24   | 192.168.1/24
!      | 192.168.1.0/26 | 192.168.1.226/32
!      | 192.168.1/24   | 192.168.1/24
!      | 192.168.1/24   | 192.168.1.0/25
!      | 192.168.1/24   | 192.168.1/24
!      | 192.168.1/24   | 192.168.1.128/25
!      | 10/8           | 10/8
!      | 10.0.0.0/32    | 10/8
!      | 10.1.2.3/32    | 10.1.2.3/32
!      | 10.1.2/24      | 10.1.2/24
!      | 10.1/16        | 10.1/16
!      | 10/8           | 10/8
!      | 10/8           | 11/8
!      | 10/8           | 9/8
! (14 rows)

  -- now test some support functions
  SELECT '' AS ten, i AS inet, host(i), text(i), family(i) FROM INET_TBL;
   ten |       inet       |     host      |       text       | family
  -----+------------------+---------------+------------------+--------
!      | 192.168.1/24     | 192.168.1.226 | 192.168.1.226/32 |      4
!      | 192.168.1.226/32 | 192.168.1.226 | 192.168.1.226/32 |      4
!      | 192.168.1/24     | 192.168.1.0   | 192.168.1.0/32   |      4
!      | 192.168.1.0/25   | 192.168.1.0   | 192.168.1.0/32   |      4
!      | 192.168.1/24     | 192.168.1.255 | 192.168.1.255/32 |      4
!      | 192.168.1.128/25 | 192.168.1.255 | 192.168.1.255/32 |      4
!      | 10/8             | 10.1.2.3      | 10.1.2.3/32      |      4
!      | 10/8             | 10.1.2.3      | 10.1.2.3/32      |      4
!      | 10.1.2.3/32      | 10.1.2.3      | 10.1.2.3/32      |      4
!      | 10.1.2/24        | 10.1.2.3      | 10.1.2.3/32      |      4
!      | 10.1/16          | 10.1.2.3      | 10.1.2.3/32      |      4
!      | 10/8             | 10.1.2.3      | 10.1.2.3/32      |      4
!      | 11/8             | 11.1.2.3      | 11.1.2.3/32      |      4
!      | 9/8              | 9.1.2.3       | 9.1.2.3/32       |      4
! (14 rows)

  SELECT '' AS ten, c AS cidr, broadcast(c),
    i AS inet, broadcast(i) FROM INET_TBL;
   ten |      cidr      |   broadcast    |       inet       |    broadcast
! -----+----------------+----------------+------------------+------------------
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1/24     | 192.168.1/24
!      | 192.168.1.0/26 | 192.168.1.0/26 | 192.168.1.226/32 | 192.168.1.226/32
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1/24     | 192.168.1/24
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1.0/25   | 192.168.1.0/25
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1/24     | 192.168.1/24
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1.128/25 | 192.168.1.128/25
!      | 10/8           | 10/8           | 10/8             | 10/8
!      | 10.0.0.0/32    | 10.0.0.0/32    | 10/8             | 10/8
!      | 10.1.2.3/32    | 10.1.2.3/32    | 10.1.2.3/32      | 10.1.2.3/32
!      | 10.1.2/24      | 10.1.2/24      | 10.1.2/24        | 10.1.2/24
!      | 10.1/16        | 10.1/16        | 10.1/16          | 10.1/16
!      | 10/8           | 10/8           | 10/8             | 10/8
!      | 10/8           | 10/8           | 11/8             | 11/8
!      | 10/8           | 10/8           | 9/8              | 9/8
! (14 rows)

  SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)",
    i AS inet, network(i) AS "network(inet)" FROM INET_TBL;
   ten |      cidr      | network(cidr)  |       inet       |  network(inet)
! -----+----------------+----------------+------------------+------------------
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1/24     | 192.168.1/24
!      | 192.168.1.0/26 | 192.168.1.0/26 | 192.168.1.226/32 | 192.168.1.226/32
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1/24     | 192.168.1/24
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1.0/25   | 192.168.1.0/25
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1/24     | 192.168.1/24
!      | 192.168.1/24   | 192.168.1/24   | 192.168.1.128/25 | 192.168.1.128/25
!      | 10/8           | 10/8           | 10/8             | 10/8
!      | 10.0.0.0/32    | 10.0.0.0/32    | 10/8             | 10/8
!      | 10.1.2.3/32    | 10.1.2.3/32    | 10.1.2.3/32      | 10.1.2.3/32
!      | 10.1.2/24      | 10.1.2/24      | 10.1.2/24        | 10.1.2/24
!      | 10.1/16        | 10.1/16        | 10.1/16          | 10.1/16
!      | 10/8           | 10/8           | 10/8             | 10/8
!      | 10/8           | 10/8           | 11/8             | 11/8
!      | 10/8           | 10/8           | 9/8              | 9/8
! (14 rows)

  SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)",
    i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL;
   ten |      cidr      | masklen(cidr) |       inet       | masklen(inet)
! -----+----------------+---------------+------------------+---------------
!      | 192.168.1/24   |            24 | 192.168.1/24     |            24
!      | 192.168.1.0/26 |            26 | 192.168.1.226/32 |            32
!      | 192.168.1/24   |            24 | 192.168.1/24     |            24
!      | 192.168.1/24   |            24 | 192.168.1.0/25   |            25
!      | 192.168.1/24   |            24 | 192.168.1/24     |            24
!      | 192.168.1/24   |            24 | 192.168.1.128/25 |            25
!      | 10/8           |             8 | 10/8             |             8
!      | 10.0.0.0/32    |            32 | 10/8             |             8
!      | 10.1.2.3/32    |            32 | 10.1.2.3/32      |            32
!      | 10.1.2/24      |            24 | 10.1.2/24        |            24
!      | 10.1/16        |            16 | 10.1/16          |            16
!      | 10/8           |             8 | 10/8             |             8
!      | 10/8           |             8 | 11/8             |             8
!      | 10/8           |             8 | 9/8              |             8
! (14 rows)

  SELECT '' AS four, c AS cidr, masklen(c) AS "masklen(cidr)",
    i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL
    WHERE masklen(c) <= 8;
   four | cidr | masklen(cidr) | inet | masklen(inet)
! ------+------+---------------+------+---------------
!       | 10/8 |             8 | 10/8 |             8
!       | 10/8 |             8 | 10/8 |             8
!       | 10/8 |             8 | 11/8 |             8
!       | 10/8 |             8 | 9/8  |             8
  (4 rows)

  SELECT '' AS six, c AS cidr, i AS inet FROM INET_TBL
    WHERE c = i;
   six |     cidr     |     inet
! -----+--------------+--------------
!      | 192.168.1/24 | 192.168.1/24
!      | 10.1.2.3/32  | 10.1.2.3/32
  (2 rows)

  SELECT '' AS ten, i, c,
***************
*** 175,222 ****
    i >> c AS sup, i >>= c AS spe
    FROM INET_TBL;
   ten |        i         |         c          | lt | le | eq | ge | gt | ne | sb | sbe | sup | spe
! -----+------------------+--------------------+----+----+----+----+----+----+----+-----+-----+-----
!      | 192.168.1.226/24 | 192.168.1.0/24     | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 192.168.1.226    | 192.168.1.0/26     | f  | f  | f  | t  | t  | t  | f  | f   | f   | f
!      | 192.168.1.0/24   | 192.168.1.0/24     | f  | t  | t  | t  | f  | f  | f  | t   | f   | t
!      | 192.168.1.0/25   | 192.168.1.0/24     | f  | f  | f  | t  | t  | t  | t  | t   | f   | f
!      | 192.168.1.255/24 | 192.168.1.0/24     | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 192.168.1.255/25 | 192.168.1.0/24     | f  | f  | f  | t  | t  | t  | t  | t   | f   | f
!      | 10.1.2.3/8       | 10.0.0.0/8         | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 10.1.2.3/8       | 10.0.0.0/32        | t  | t  | f  | f  | f  | t  | f  | f   | t   | t
!      | 10.1.2.3         | 10.1.2.3/32        | f  | t  | t  | t  | f  | f  | f  | t   | f   | t
!      | 10.1.2.3/24      | 10.1.2.0/24        | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 10.1.2.3/16      | 10.1.0.0/16        | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 10.1.2.3/8       | 10.0.0.0/8         | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 11.1.2.3/8       | 10.0.0.0/8         | f  | f  | f  | t  | t  | t  | f  | f   | f   | f
!      | 9.1.2.3/8        | 10.0.0.0/8         | t  | t  | f  | f  | f  | t  | f  | f   | f   | f
!      | 10:23::f1/64     | 10:23::f1/128      | t  | t  | f  | f  | f  | t  | f  | f   | t   | t
!      | 10:23::ffff      | 10:23::8000/113    | f  | f  | f  | t  | t  | t  | t  | t   | f   | f
!      | ::4.3.2.1/24     | ::ffff:1.2.3.4/128 | t  | t  | f  | f  | f  | t  | f  | f   | t   | t
! (17 rows)

  -- check the conversion to/from text and set_netmask
  SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL;
   ten |   set_masklen
! -----+------------------
!      | 192.168.1.226/24
!      | 192.168.1.226/24
!      | 192.168.1.0/24
!      | 192.168.1.0/24
!      | 192.168.1.255/24
!      | 192.168.1.255/24
!      | 10.1.2.3/24
!      | 10.1.2.3/24
!      | 10.1.2.3/24
!      | 10.1.2.3/24
!      | 10.1.2.3/24
!      | 10.1.2.3/24
!      | 11.1.2.3/24
!      | 9.1.2.3/24
!      | 10:23::f1/24
!      | 10:23::ffff/24
!      | ::4.3.2.1/24
! (17 rows)

  -- check that index works correctly
  CREATE INDEX inet_idx1 ON inet_tbl(i);
--- 162,203 ----
    i >> c AS sup, i >>= c AS spe
    FROM INET_TBL;
   ten |        i         |       c        | lt | le | eq | ge | gt | ne | sb | sbe | sup | spe
! -----+------------------+----------------+----+----+----+----+----+----+----+-----+-----+-----
!      | 192.168.1/24     | 192.168.1/24   | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 192.168.1.226/32 | 192.168.1.0/26 | f  | f  | f  | t  | t  | t  | f  | f   | f   | f
!      | 192.168.1/24     | 192.168.1/24   | f  | t  | t  | t  | f  | f  | f  | t   | f   | t
!      | 192.168.1.0/25   | 192.168.1/24   | f  | f  | f  | t  | t  | t  | t  | t   | f   | f
!      | 192.168.1/24     | 192.168.1/24   | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 192.168.1.128/25 | 192.168.1/24   | f  | f  | f  | t  | t  | t  | t  | t   | f   | f
!      | 10/8             | 10/8           | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 10/8             | 10.0.0.0/32    | t  | t  | f  | f  | f  | t  | f  | f   | t   | t
!      | 10.1.2.3/32      | 10.1.2.3/32    | f  | t  | t  | t  | f  | f  | f  | t   | f   | t
!      | 10.1.2/24        | 10.1.2/24      | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 10.1/16          | 10.1/16        | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 10/8             | 10/8           | f  | f  | f  | t  | t  | t  | f  | t   | f   | t
!      | 11/8             | 10/8           | f  | f  | f  | t  | t  | t  | f  | f   | f   | f
!      | 9/8              | 10/8           | t  | t  | f  | f  | f  | t  | f  | f   | f   | f
! (14 rows)

  -- check the conversion to/from text and set_netmask
  SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL;
   ten | set_masklen
! -----+--------------
!      | 192.168.1/24
!      | 192.168.1/24
!      | 192.168.1/24
!      | 192.168.1/24
!      | 192.168.1/24
!      | 192.168.1/24
!      | 10.1.2/24
!      | 10.1.2/24
!      | 10.1.2/24
!      | 10.1.2/24
!      | 10.1.2/24
!      | 10.1.2/24
!      | 11.1.2/24
!      | 9.1.2/24
! (14 rows)

  -- check that index works correctly
  CREATE INDEX inet_idx1 ON inet_tbl(i);
***************
*** 224,243 ****
  SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr;
         c        |        i
  ----------------+------------------
!  192.168.1.0/24 | 192.168.1.0/25
!  192.168.1.0/24 | 192.168.1.255/25
!  192.168.1.0/26 | 192.168.1.226
  (3 rows)

  SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr;
         c        |        i
  ----------------+------------------
!  192.168.1.0/24 | 192.168.1.0/24
!  192.168.1.0/24 | 192.168.1.226/24
!  192.168.1.0/24 | 192.168.1.255/24
!  192.168.1.0/24 | 192.168.1.0/25
!  192.168.1.0/24 | 192.168.1.255/25
!  192.168.1.0/26 | 192.168.1.226
  (6 rows)

  SET enable_seqscan TO on;
--- 205,224 ----
  SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr;
         c        |        i
  ----------------+------------------
!  192.168.1/24   | 192.168.1.0/25
!  192.168.1/24   | 192.168.1.128/25
!  192.168.1.0/26 | 192.168.1.226/32
  (3 rows)

  SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr;
         c        |        i
  ----------------+------------------
!  192.168.1/24   | 192.168.1/24
!  192.168.1/24   | 192.168.1/24
!  192.168.1/24   | 192.168.1/24
!  192.168.1/24   | 192.168.1.0/25
!  192.168.1/24   | 192.168.1.128/25
!  192.168.1.0/26 | 192.168.1.226/32
  (6 rows)

  SET enable_seqscan TO on;

======================================================================


Re: Patchless postgres 8.x on AIX

From
Tom Lane
Date:
Seneca Cunningham <scunning@ca.afilias.info> writes:
> What is happening with postgres certainly appears to be related to the
> linker; in dynahash.c, the keycopy functions that work with no new
> linker flags (strncpy, memmove worked as a memcpy replacement) are all
> exported by libreadline.a, while the segfaulting/infinite-looping memcpy
> is not.

libreadline exports these??  I'd say you have a seriously braindead copy
of libreadline ... can you recompile a fresh copy off the net?

The inet failures look like there is consistently no support for IPv6.
I wonder if the linker is somehow replacing our own inet-parsing
subroutines with a non-IPv6-aware set.  It's conceivable that there
could be a name collision with subroutines from an old version of
libbind.

            regards, tom lane

Re: Patchless postgres 8.x on AIX

From
Seneca Cunningham
Date:
Tom Lane wrote:
> Seneca Cunningham <scunning@ca.afilias.info> writes:
>
>>What is happening with postgres certainly appears to be related to the
>>linker; in dynahash.c, the keycopy functions that work with no new
>>linker flags (strncpy, memmove worked as a memcpy replacement) are all
>>exported by libreadline.a, while the segfaulting/infinite-looping memcpy
>>is not.
>
>
> libreadline exports these??  I'd say you have a seriously braindead copy
> of libreadline ... can you recompile a fresh copy off the net?

That was just IBM's rpm of readline 4.3, my fresh build of readline 5.0
exports memcpy in addition to the aforementioned functions.  As a
result, LDFLAGS-less postgres doesn't segfault but it gets its memcpy
linked through libreadline.  libreadline's build scripts, at least for
5.0, don't seem to give a build that can be properly linked against on
AIX, and it's entirely possible that my build used different linker
flags than IBM's to get a libreadline that actually exports what it
provides.

> The inet failures look like there is consistently no support for IPv6.
> I wonder if the linker is somehow replacing our own inet-parsing
> subroutines with a non-IPv6-aware set.  It's conceivable that there
> could be a name collision with subroutines from an old version of
> libbind.

The linker appears to be grabbing the inet functions from the AIX libc,
not the postgres set.  LDFLAGS is placed before all the SUBSYS.o, and by
my understanding of the AIX linker, adding "-lc" to LDFLAGS would cause
it to search libc.a before utils/SUBSYS.o and use the functions like
inet_net_pton from libc.

--
Seneca Cunningham
scunning@ca.afilias.info