initdb bug in Postgres on Ultrasparc platform

Started by Silvio Macedoover 26 years ago1 messagesbugs
Jump to latest
#1Silvio Macedo
smacedo@ic.ac.uk

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