Postgresql on Ultraparc/Linux , Bug report and patch! - Mailing list pgsql-bugs
From | Silvio Macedo |
---|---|
Subject | Postgresql on Ultraparc/Linux , Bug report and patch! |
Date | |
Msg-id | Pine.LNX.4.10.9911251532310.1828-300000@test133.ee.ic.ac.uk Whole thread Raw |
Responses |
Re: [BUGS] Postgresql on Ultraparc/Linux , Bug report and patch!
Re: [BUGS] Postgresql on Ultraparc/Linux , Bug report and patch! |
List | pgsql-bugs |
============================================================================ POSTGRESQL BUG REPORT TEMPLATE ============================================================================ Your name : Silvio Macedo Your email address : smacedo@ic.ac.uk (or smacedo@inescn.pt) System Configuration --------------------- Architecture (example: Intel Pentium) : Sun Ultrasparc 1 (143Mhz, 2.1 Gb disk, 64Mb RAM) Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.12 ELF, (RH6.1) PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3/2/SNAP Compiler used (example: gcc 2.8.0) : gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (comes with RH6.1) GNUlibc 2.1.2 Please enter a FULL description of your problem: ------------------------------------------------ In 64 bit machines like the Ultraparc, strncmp can return -256. In src/backend/utils/adt/name.c you do: return (bool) strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0; In this way you are casting strncmp to bool, and not the comparison. This is the description of the consequences, that I sent before I discovered the problem: (I am giving a really detailed description to maximize the chances that you find the solution to my problem) I have installed postgres many times in several Linux/Intel systems. Now, I am trying to install Pg 6.5.3 ( or any other version of Pg) in a Linux/(ultra)Sparc system. The system seems stable in any task other than postgres stuff, but when I run initdb, it always dies with and error about : "Attribute 'aggtransfn1' is repeated." I have downloaded source distribution PG 6.5.3, PG Snapshot, PG 6.5.2 and RPM binaries of Pg from RedHat 6.1 distribution and even SRPMS. In all of them, after compiling and/or installing, when I do the initdb -d, the script dies with this message: > <aggname name> <aggowner int4> <aggtransfn1 regproc> <aggtransfn2 regproc> <aggfinalfn regproc> <aggbasetype oid> <aggtranstype1 oid> <aggtranstype2 oid> <aggfinaltype oid> <agginitval1 text> <agginitval2 text> > ERROR: Attribute 'aggtransfn1' is repeated ERROR: Attribute 'aggtransfn1' is repeated initdb: could not create template database initdb: cleaning up by wiping out /usr/local/pgsql/data/base/template1 I have also tried initdb with the full command line, etc.. This happens with all the versions of Pg that I have tested: Pg Snapshot 22 Nov Pg 6.5.3, Pg 6.5.2, Binaries in RPM from RedHat 6.1 Sparc Source SRPM from '' '' Then, I investigated the problem deeper, and deeper. If I remove aggtransfn2 from the local1.????.bki.source, it gives the same error in agginitval2. I replaced the ERROR with a NOTICE on the elog on the file src/backend/catalog/heap.c in the function CheckAttributeNames() and everything went ok until I started regression tests. Lots of 'failed' appeared in the char/string related tests, and those were real problems, because I checked it myself (not just little differences); the backend closed connection in some tests. I then added some lines in the src/backend/catalog/heap.c to see if the strings were read ok and if NAMEDATALEN was ok. Yes, they were. aggtransfn1 was compared to aggransfn2 by a call to nameeq(), and this function returned that they were equal (obviously they differ on the last character). Then, finally I replaced the call to nameeq to a direct strncmp() between both tuple->data's and it worked. The regression tests still failed. Maybe there is a problem in the strncmp libraries in my system ? oh no... [PS: The source of this problem as I wrote above, is in Postgres name.c file, in nameeq() ] Please describe a way to repeat the problem. Please try to provide a concise reproducible example, if at all possible: ---------------------------------------------------------------------- configure --with-x --with-tcl --with-template=linux_sparc make make install cd /usr/local/pgsql initdb If you know how this problem might be fixed, list the solution below: --------------------------------------------------------------------- I send both diff -f and diff -u in attach --- postgresql-6.5.3/src/backend/utils/adt/name.c Mon Aug 2 06:24:55 1999 +++ postgresql-6.5.3.my/src/backend/utils/adt/name.c Thu Nov 25 11:53:39 1999 @@ -87,7 +87,7 @@ if (!arg1 || !arg2) return 0; else - return (bool) strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0; + return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0); } bool ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, `````````````````````````````````````````````````````````````````````````` Silvio Emanuel Nunes Barbosa de Macedo smacedo@ic.ac.uk smacedo@inescn.pt Imperial College, University of London INESC Porto Intelligent and Interactive Systems Telecom. and Multimedia Exhibition Road, Pc da Republica, 93 London SW7 2AZ, England 4050-497 PORTO PORTUGAL Tel:+44 171 5946323 Tel:+351 22 2094220
pgsql-bugs by date: