Bug #52060 test udf fails on Snow Leopard
Submitted: 15 Mar 2010 10:17 Modified: 10 Feb 2011 14:45
Reporter: Martin Hansson Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: Server Severity:S3 (Non-critical)
Version:5.1.46, 5.0 OS:MacOS (10.6.x)
Assigned to: John Embretsen CPU Architecture:Any

[15 Mar 2010 10:17] Martin Hansson
Description:
The 'udf' test fails on a clean build on SL:

main.udf                                 [ fail ]
        Test ended at 2010-03-15 11:14:23

CURRENT_TEST: main.udf
--- /Users/martin/bzr/mysql-5.1-bugteam/mysql-test/r/udf.result	2010-01-22 13:00:41.000000000 +0300
+++ /Users/martin/bzr/mysql-5.1-bugteam/mysql-test/r/udf.reject	2010-03-15 13:14:23.000000000 +0300
@@ -39,7 +39,7 @@
 select reverse_lookup(127,0,0,1);
 select reverse_lookup("localhost");
 reverse_lookup("localhost")
-NULL
+broadcasthost
 select avgcost();
 ERROR HY000: Can't initialize function 'avgcost'; wrong number of arguments: AVGCOST() requires two arguments
 select avgcost(100,23.76);

How to repeat:
On an SL machine:

- Make a bzr branch of the 5.1 tree
- build
- run udf test like so "./mtr udf"

Suggested fix:
Make this udf work the same way on all supported platforms, or deactivate in places where it does not work.
[15 Mar 2010 17:28] Valeriy Kravchuk
On 10.5.x I see no problems (recent 5.1. from bzr, built with BUILD/compile-pentium-debug-max):

77-52-28-202:mysql-test openxs$ ./mtr udf
Logging: ./mtr  udf
100315 19:26:02 [Warning] Setting lower_case_table_names=2 because file system for /var/folders/dX/dXCzvuSlHX4Op1g-o1jIWk+++TI/-Tmp-/BvTS2F0SkA/ is case insensitive
100315 19:26:02 [Note] Plugin 'FEDERATED' is disabled.
100315 19:26:02 [Note] Plugin 'ndbcluster' is disabled.
MySQL Version 5.1.46
Checking supported features...
 - using ndbcluster when necessary, mysqld supports it
 - SSL connections supported
 - binaries are debug compiled
Collecting tests...
vardir: /Users/openxs/bzr/mysql-5.1-work/mysql-test/var
Removing old var directory...
Creating var directory '/Users/openxs/bzr/mysql-5.1-work/mysql-test/var'...
Installing system database...
Using server port 50339

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
main.udf                                 [ pass ]   1203
------------------------------------------------------------
The servers were restarted 0 times
Spent 1.203 of 8 seconds executing testcases

Completed: All 1 tests were successful.

What am I doing wrong? Is is really something 10.6.x-specific?
[16 Mar 2010 9:18] Martin Hansson
Valeriy,
What is the result of this on your system?

long unsigned int taddr = 0xffffffff;
struct hostent* hp = gethostbyaddr(&taddr, sizeof(taddr), AF_INET);
[17 Mar 2010 11:11] Mattias Jonsson
main.udf test fails on my mac too (at least in mysql-5.1-bugteam, svoj@sun.com-20100316173356-moq52r53w1tiokmg) and have been doing so for quite a while...

mysql-test$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.6.2
BuildVersion:	10C540
[18 Mar 2010 10:17] John Embretsen
The test fails on my Mac OS X 10.6 as well.

I suggest we simply hide the output from the failing statement, i.e. put the third reverse_lookup function call in this segment in between the --disable/enable_result_log commands:

----------------------
# These two functions should return "localhost", but it's
# depending on configuration, so just call them and don't log the result
--disable_result_log
select reverse_lookup("127.0.0.1");
select reverse_lookup(127,0,0,1);
--enable_result_log

select reverse_lookup("localhost");
----------------------

The purpose of the test is (apparently) to test the basic functionality of User Defined Functions, and not to test host name resolution on all platforms.
[18 Mar 2010 10:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/103670

3408 John H. Embretsen	2010-03-18
      Bug#52060 - test udf fails on Snow Leopard
      reverse DNS lookup of "localhost" returns "broadcasthost" on Snow Leopard, and NULL on most others.
      Simply ignore the output, as this is not an essential part of UDF testing.
[18 Mar 2010 10:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/103671

3408 John H. Embretsen	2010-03-18
      Bug#52060 - test udf fails on Snow Leopard
      reverse DNS lookup of "localhost" returns "broadcasthost" on Snow Leopard, and NULL on most others.
      Simply ignore the output, as this is not an essential part of UDF testing.
[18 Mar 2010 10:33] John Embretsen
Patch pending review and potential Triaging.
Real patch is at http://lists.mysql.com/commits/103671 (ignore the first commit).
[22 Mar 2010 7:42] John Embretsen
Martin, can you tell if the patch http://lists.mysql.com/commits/103671 works ok in your environment?

Horst, can you please take look at the diff to verify that the suggested fix looks ok from a QA point of view?

thanks!
[22 Mar 2010 8:08] Mattias Jonsson
The patch makes the test pass in my environment. Thanks!
[22 Mar 2010 12:50] John Embretsen
Committed as revid john.embretsen@sun.com-20100318102627-j7tf8qrwcuo35b6k.

Pushed to mysql-5.1-bugteam with revid john.embretsen@sun.com-20100322090656-w4ixy7p67fb3vr29.
Merged/pushed to mysql-pe with revid john.embretsen@sun.com-20100322093920-5m0tgqf2ky9p43n2
[26 Mar 2010 8:20] Bugs System
Pushed into 5.5.4-m3 (revid:alik@sun.com-20100326080914-2pz8ns984e0spu03) (version source revid:alexey.kopytov@sun.com-20100322132851-8j3m42x4ldi1kca5) (merge vers: 5.5.3-m2) (pib:16)
[26 Mar 2010 8:24] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100326081116-m3v4l34yhr43mtsv) (version source revid:alik@sun.com-20100325072612-4sds00ix8ajo1e84) (pib:16)
[26 Mar 2010 8:29] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100326081944-qja07qklw1p2w7jb) (version source revid:alik@sun.com-20100325073410-4t4i9gu2u1pge7xb) (merge vers: 6.0.14-alpha) (pib:16)
[27 Mar 2010 16:20] Paul DuBois
Changes to test case. No changelog entry needed.
[6 Apr 2010 7:56] Bugs System
Pushed into 5.1.46 (revid:sergey.glukhov@sun.com-20100405111026-7kz1p8qlzglqgfmu) (version source revid:john.embretsen@sun.com-20100318102627-j7tf8qrwcuo35b6k) (merge vers: 5.1.46) (pib:16)
[6 Apr 2010 14:20] Paul DuBois
No changelog entry needed.
[17 Jun 2010 12:02] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:44] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:martin.skold@mysql.com-20100609211156-tsac5qhw951miwtt) (merge vers: 5.1.46-ndb-6.2.19) (pib:16)
[17 Jun 2010 13:29] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[9 Feb 2011 8:48] Georgi Kodinov
Can you please backport the fix to 5.0 ?
[9 Feb 2011 9:50] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/130811

2902 John H. Embretsen	2011-02-09
      Backport to 5.0: Fix for Bug#52060 - test udf fails on Snow Leopard.
      Reverse DNS lookup of "localhost" returns "broadcasthost" on Snow Leopard (Mac), and NULL on most others.
      Simply ignore the output, as this is not an essential part of UDF testing.
[9 Feb 2011 10:21] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:john.embretsen@oracle.com-20110209101905-mmuq9b2ifgjxthj2) (version source revid:john.embretsen@oracle.com-20110209101905-mmuq9b2ifgjxthj2) (merge vers: 5.6.2) (pib:24)
[9 Feb 2011 10:21] Bugs System
Pushed into mysql-5.5 5.5.10 (revid:john.embretsen@oracle.com-20110209101625-uxsch8cz9zj9wc6k) (version source revid:john.embretsen@oracle.com-20110209101625-uxsch8cz9zj9wc6k) (merge vers: 5.5.10) (pib:24)
[9 Feb 2011 10:22] Bugs System
Pushed into mysql-5.1 5.1.56 (revid:john.embretsen@oracle.com-20110209101323-cl0hropto7r13jq9) (version source revid:john.embretsen@oracle.com-20110209101323-cl0hropto7r13jq9) (merge vers: 5.1.56) (pib:24)
[9 Feb 2011 10:23] Bugs System
Pushed into mysql-5.0 5.0.93 (revid:john.embretsen@oracle.com-20110209095009-swtf540armpv1m9a) (version source revid:john.embretsen@oracle.com-20110209095009-swtf540armpv1m9a) (merge vers: 5.0.93) (pib:24)
[9 Feb 2011 10:28] John Embretsen
Backported patch pushed to mysql-5.0. Revision was null-merged to 5.1, 5.5 and trunk.