Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

memcpy SEGV on AIX 5.3


  • From: Seneca Cunningham <scunning(at)ca(dot)afilias(dot)info>
  • To: pgsql-hackers(at)postgresql(dot)org
  • Cc: pgsql-ports(at)postgresql(dot)org
  • Subject: memcpy SEGV on AIX 5.3
  • Date: Mon, 24 Oct 2005 18:17:04 -0400
  • Message-id: <435D5D60(dot)7040800(at)ca(dot)afilias(dot)info>

On an powerPC AIX 5.3 box, initdb from 8.1beta4 segfaults at src/backend/utils/hash/dynahash.c:673. No segfaults occur and all 98 regression tests pass if a test is added to see if keycopy is memcpy and if it is, go through a loop memcpying one byte at a time instead of memcpying everything at once.

Configuration details:
-bash-2.05b$ gcc -v
Using built-in specs.
Target: powerpc-ibm-aix5.3.0.0
Configured with: /opt/src/gcc4/gcc-4.0.1/configure --prefix=/opt/dbs/gcc4 --enable-languages=c,c++
Thread model: aix
gcc version 4.0.1
-bash-2.05b$ oslevel -r
5300-03
./configure --prefix=/opt/dbs/pgsql81b4-afilias-AIX53-2005-10-24 --with-includes=/opt/freeware/include --enable-debug --enable-thread-safety --with-libraries=/opt/freeware/lib --enable-casert

InitPostgres
`-> RelationCacheInitialize
    `-> formrdesc
        `-> RelationCacheInsert
            `-> hash_search
                `-> keycopy (keycopy == memcpy)

--- dynahash.c.orig 2005-10-14 22:49:33.000000000 -0400
+++ dynahash.c  2005-10-24 18:00:51.785106864 -0400
@@ -670,7 +670,14 @@


            /* copy key into record */
            currBucket->hashvalue = hashvalue;
-           hashp->keycopy(ELEMENTKEY(currBucket), keyPtr, keysize);
+           if (hashp->keycopy == memcpy)
+           {
+               int tempfoo;
+               for (tempfoo = 0; tempfoo < keysize; tempfoo++)
+ memcpy(ELEMENTKEY(currBucket)+tempfoo, keyPtr+tempfoo, 1);
+           }
+           else
+               hashp->keycopy(ELEMENTKEY(currBucket), keyPtr, keysize);


            /* caller is expected to fill the data field on return */

--
Seneca Cunningham
scunning(at)ca(dot)afilias(dot)info



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group