Bug 133208

Summary: MySQL number overflow problem
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Gregory Youngblood <suse>
Component: OtherAssignee: Petr Ostadal <postadal>
Status: RESOLVED WORKSFORME QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None    
Version: Final   
Target Milestone: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Found By: Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Gregory Youngblood 2005-11-10 03:31:55 UTC
Problem exists in both SuSE 9.3 Pro and SuSE 10.0. Does not happen on other distros (FreeBSD, Debian, Trustix) using same version of database.

Mysql 4.1.13-3 (SUSE 10.0)
Mysql 4.1.10a (SUSE 9.3)

Mysql functions min and max incorrectly returns negative numbers for very large integers.

Duplicate with:
create temporary table xyzzy (id int(10) unsigned);
insert into xyzzy values (4294967093);
insert into xyzzy values (4294967094);
insert into xyzzy values (4294967095);
select * from xyzzy;
+------------+
| id         |
+------------+
| 4294967093 |
| 4294967094 |
| 4294967095 |
+------------+
3 rows in set (0.00 sec)

select min(id),max(id) from xyzzy;
+---------+---------+
| min(id) | max(id) |
+---------+---------+
|    -203 |    -201 |
+---------+---------+
1 row in set (0.00 sec)
Comment 1 Gregory Youngblood 2005-11-10 18:12:16 UTC
I have downloaded mysql-max-4.1.15-pc-linux-gnu-i686-glibc23 from mysql.org and tested it on SUSE Linux 10.0. It worked correctly and did not have the above problem.

Problem appears isolated to the SUSE builds of mysql.
Comment 2 Gregory Youngblood 2005-11-10 22:37:24 UTC
The mysqld downloaded from mysql.org installed in /usr/local/mysql and using the installed my.cnf works correctly. This includes connecting to the database from the installed suse mysql command line tool. Problem appears to be with mysqld.

Comparison of mysqlds:
[SUSE] /usr/sbin/mysqld:
        linux-gate.so.1 =>  (0xffffe000)
        librt.so.1 => /lib/tls/librt.so.1 (0x40021000)
        libz.so.1 => /lib/libz.so.1 (0x4002a000)
        libwrap.so.0 => /lib/libwrap.so.0 (0x4003b000)
        libdl.so.2 => /lib/libdl.so.2 (0x40043000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40047000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x40059000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x4008c000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x400a1000)
        libm.so.6 => /lib/tls/libm.so.6 (0x4015f000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40182000)
        libc.so.6 => /lib/tls/libc.so.6 (0x4018a000)
        /lib/ld-linux.so.2 (0x40000000)

[MySQL] /usr/local/mysql/bin/mysqld:
        linux-gate.so.1 =>  (0xffffe000)
        librt.so.1 => /lib/tls/librt.so.1 (0x40021000)
        libz.so.1 => /lib/libz.so.1 (0x4002a000)
        libdl.so.2 => /lib/libdl.so.2 (0x4003b000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x4003f000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x40051000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x40083000)
        libm.so.6 => /lib/tls/libm.so.6 (0x40099000)
        libc.so.6 => /lib/tls/libc.so.6 (0x400bc000)
        /lib/ld-linux.so.2 (0x40000000)

Extra libs in SUSE: libgcc_s, libwrap, and libstdc++
Comment 3 Gregory Youngblood 2005-11-10 23:23:52 UTC
Oops: The ldd dumps from SUSE above are from a 9.3 system and not from the 10.0 system. Sorry about that.

Also, one new oddity (and my last comment, I hope): I installed mysql 4.1.15 (from mysql.org) to my user's home directory as my normal user account (and verified that my user account did not have access to /etc/dbconfig and was not in group mysql); confirmed that 4.1.15 worked; and then shut 4.1.15 down. After I confirmed it was down, I deleted all the files.

Now, when I connect to the system's mysql (4.1.13-Max) and run the test again, I get the correct results. I have not rebooted to see if the problem returns. I have confirmed that it works for other users and not just my user account. Very strange. The only other change to the system was YOU updating two (I think) files earlier today.

Comment 4 Pavel Nemec 2005-11-15 10:08:35 UTC
i am trying to reproduce this bug.
But:
mysql> select * from xyzzy
    -> ;
+------------+
| id         |
+------------+
| 4294967093 |
| 4294967094 |
| 4294967095 |
+------------+
3 rows in set (0.00 sec)

mysql> select min(id), max(id) from xyzzy;
+------------+------------+
| min(id)    | max(id)    |
+------------+------------+
| 4294967093 | 4294967095 |
+------------+------------+
1 row in set (0.00 sec)

mysql>    
I am using clear instalation of mysql, on suse 10.0 on i686, mysql-4.1.13-3

Do you using fresh installalation of mysql? If not could you test it on some fresh install?
Thanks

Comment 5 Petr Ostadal 2005-12-06 12:32:59 UTC
Any news?
Comment 6 Gregory Youngblood 2005-12-06 17:36:35 UTC
I have not been able to re-install everything to try this again from a fresh install. I might be able to in about a week, but right now I've got a really tight deadline that I have to get through first.

I think the problem is library related, but can't prove it. See previous note about loading precompiled from mysql directly and things magically getting fixed. 
Comment 7 Petr Ostadal 2006-01-04 14:02:29 UTC
Close bug, please reopen it, if you have more inforamtion to investigate this bug.