initdb bug in Postgres on Ultrasparc platform - Mailing list pgsql-bugs

From Silvio Macedo
Subject initdb bug in Postgres on Ultrasparc platform
Date
Msg-id Pine.LNX.4.10.9911242251470.5606-100000@test133.ee.ic.ac.uk
Whole thread Raw
List pgsql-bugs
Hello!

Regarding the email I sent yesterday about a bug when running initdb in a
Linux/Ultraparc machine, I want to add that I have found the problem.

There is a simple fix for the bug that I detected.

In the src/backend/utils/adt/name.c ,
the function nameeq(), will fail on linux/ultrasparc because sometimes
strncmp will return -256, which when casted to bool, gives 0

What you do is
    return (bool) strncmp(...) == 0
and you should do
        return (bool) (strncmp(...)==0)

because otherwise, if strncmp returns -256, the bool cast will make it 0,
which is not what you want.

I will send a proper bug report with the patch in a few minutes.

,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
``````````````````````````````````````````````````````````````````````````
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:

Previous
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] ecpg generates wrong code for EXEC SQL FREE
Next
From: Silvio Macedo
Date:
Subject: NOW, I SEND A PATCH ; initdb & general string compares - all Pg 6.5.2,6.5.3,snapshot,RPMS, SRPMS