[MacPorts] #32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts
#32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts -------------------------------------+-------------------------------------- Reporter: chad@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: | Port: erlang -------------------------------------+-------------------------------------- Following is an email exchange which clearly describes the issue this patch is intended to fix: Found the problem. It's a bug in the configure scripts located in lib/odbc of the Erlang source code, which hard code '-liodbc' when $host_os is darwin -- this prevents anyone from being able to properly link against a unixODBC install on OS X, which needs '-lodbc' instead. In my case, via MacPorts, this apparently meant it was using the MacPorts unixODBC headers, but linking against the default OS X iODBC lib, which I'm guessing is what led to the weird behavior I was seeing. I've created a patch for the MacPorts version of Erlang, but I'm pretty autoconf clueless, so all it does is hard code '-lodbc' in place of '-liodbc', which is clearly not the right upstream solution. ;) If there's anything else I can do to help fix this bug, please let me know. Thanks, Chad On Dec 9, 2011, at 6:05 AM, Ingela Andin wrote: Hi! Sound like a problem in the odbc-driver (if I remember correctly iodbc is the name of the most common driver on MAC) sql_wvarchar is defined to be Unicode encoded as UTF16 little endian. Regards Ingela Erlang/OTP team - Ericsson AB 2011/12/1, Chad Phillips -- Apartment Lines <chad@apartmentlines.com>: According to http://www.erlang.org/doc/apps/odbc/databases.html#type, the SQL_WVARCHAR ODBC data type should be translated by Erlang's ODBC driver to "Unicode binary encoded as UTF16 little endian." This works as expected on Linux, but I'm having issues on OS X, where it appears it's getting translated to UTF32 little endian, instead of UTF16 little endian. I'm using Erlang R14B04 on both machines, with the exact same database table, does anybody have an idea why this might be occurring, and how to remedy it? Additional info below for those interested. Thanks! Chad {{{ TABLE ON BOTH ARCHITECTURES: CREATE TABLE `foo` ( `bar` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LINUX ERLANG SESSION: (alaem@scratch)1> odbc:start(). ok (alaem@scratch)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []). {ok,<0.90.0>} (alaem@scratch)3> odbc:describe_table(Ref, "foo"). {ok,[{"bar",{sql_wvarchar,255}}]} (alaem@scratch)4> odbc:select_count(Ref, "SELECT * FROM foo"). {ok,1} (alaem@scratch)5> {selected, Columns, [{Bar}]} = odbc:next(Ref). {selected,["bar"],[{<<98,0,97,0,122,0>>}]} (alaem@scratch)6> unicode:characters_to_list(Bar, {utf16, little}). "baz" (alaem@scratch)7> unicode:characters_to_list(Bar, {utf32, little}). {error,[],<<98,0,97,0,122,0>>} OS X ERLANG SESSION: (alaem@colossus)1> odbc:start(). ok (alaem@colossus)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []). {ok,<0.90.0>} (alaem@colossus)3> odbc:describe_table(Ref, "foo"). {ok,[{"bar",{sql_wvarchar,255}}]} (alaem@colossus)4> odbc:select_count(Ref, "SELECT * FROM foo"). {ok,1} (alaem@colossus)5> {selected, Columns, [{Bar}]} = odbc:next(Ref). {selected,["bar"],[{<<98,0,0,0,97,0,0,0,122,0,0,0>>}]} (alaem@colossus)6> unicode:characters_to_list(Bar, {utf16, little}). [98,0,97,0,122,0] (alaem@colossus)7> unicode:characters_to_list(Bar, {utf32, little}). "baz" }}} -- Ticket URL: <https://trac.macports.org/ticket/32501> MacPorts <http://www.macports.org/> Ports system for Mac OS
#32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts -------------------------------------+-------------------------------------- Reporter: chad@… | Owner: bfulgham@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: | Port: erlang -------------------------------------+-------------------------------------- Changes (by macsforever2000@…): * owner: macports-tickets@… => bfulgham@… -- Ticket URL: <https://trac.macports.org/ticket/32501#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts -------------------------------------+-------------------------------------- Reporter: chad@… | Owner: bfulgham@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: | Port: erlang -------------------------------------+-------------------------------------- Comment(by jmr@…): Is this still needed with R15B01? -- Ticket URL: <https://trac.macports.org/ticket/32501#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts -------------------------------------+-------------------------------------- Reporter: chad@… | Owner: bfulgham@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Keywords: | Port: erlang -------------------------------------+-------------------------------------- Comment(by chad@…): I submitted the bug report upstream and the developer did put in a fix for it, but I have not tested to see if his change actually fixed the problem. It's probably ok to take this patch out, I can report back if it's still broken when I get around to upgrading. -- Ticket URL: <https://trac.macports.org/ticket/32501#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts --------------------------------------+------------------------------------- Reporter: chad@… | Owner: bfulgham@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Resolution: fixed | Keywords: Port: erlang | --------------------------------------+------------------------------------- Changes (by bfulgham@…): * status: new => closed * resolution: => fixed Comment: The contents of this patch are part of the R15B1 source base. Consequently, I'm closing this bug as fixed by upstream. Thanks for your help! -- Ticket URL: <https://trac.macports.org/ticket/32501#comment:4> MacPorts <http://www.macports.org/> Ports system for Mac OS
#32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts ---------------------+------------------------ Reporter: chad@… | Owner: bfulgham@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Resolution: | Keywords: Port: erlang | ---------------------+------------------------ Changes (by chad@…): * status: closed => reopened * resolution: fixed => Comment: Ok, the R15B1 source code may have had a fix for this issue, but it's busted again in 17.1. Posting updated patches in a few seconds... -- Ticket URL: <https://trac.macports.org/ticket/32501#comment:5> MacPorts <http://www.macports.org/> Ports system for OS X
#32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts ---------------------+------------------------- Reporter: chad@… | Owner: ciserlohn@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Resolution: | Keywords: Port: erlang | ---------------------+------------------------- Changes (by ciserlohn@…): * status: reopened => new * owner: bfulgham@… => ciserlohn@… Comment: Replying to [comment:5 chad@…]:
Ok, the R15B1 source code may have had a fix for this issue, but it's busted again in 17.1. Posting updated patches in a few seconds...
I'm not able to reproduce your problem on my 10.9.4 machine using: {{{ erlang @17.1_0+hipe+odbc+ssl+wxwidgets unixODBC @2.3.1_0 mysql-connector-odbc @5.1.8_1 mysql5-server @5.1.72_0 }}} It works as expected: {{{ 10> h(). 1: odbc:start() -> ok 2: {ok,Ref} = odbc:connect("DSN=MySQL-test;Option=3", []) -> {ok,<0.40.0>} 3: Ref -> <0.40.0> 4: odbc:describe_table(Ref, "foo") -> {ok,[{"bar",{sql_wvarchar,255}}]} 5: odbc:select_count(Ref, "SELECT * FROM foo") -> {ok,0} 6: odbc:select_count(Ref, "SELECT * FROM foo") -> {ok,1} 7: {selected,Columns,[{Bar}]} = odbc:next(Ref) -> {selected,["bar"],[{<<98,0,97,0,122,0>>}]} 8: unicode:characters_to_list(Bar, {utf16,little}) -> "baz" 9: unicode:characters_to_list(Bar, {utf32,little}) -> {error,[],<<98,0,97,0,122,0>>} }}} Erlang links against the MacPorts provided {{{unixODBC}}} without your patch: {{{ bash-4.3$ otool -L /opt/local/lib/erlang/lib/odbc-2.10.20/priv/bin/odbcserver /opt/local/lib/erlang/lib/odbc-2.10.20/priv/bin/odbcserver: /opt/local/lib/libodbc.2.dylib (compatibility version 3.0.0, current version 3.0.0) }}} And the README from R15B1 doesn't mention anything the sounds like your bug. R15B01 doesn't even have any odbc related bugfixes at all. -- Ticket URL: <https://trac.macports.org/ticket/32501#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X
#32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts -------------------------+------------------------- Reporter: chad@… | Owner: ciserlohn@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Resolution: worksforme | Keywords: Port: erlang | -------------------------+------------------------- Changes (by ciserlohn@…): * status: new => closed * resolution: => worksforme Comment: I'll close this bug as worksforme. @Chad: Feel free to reopen the bug if you can give precise instructions how to reproduce the bug. -- Ticket URL: <https://trac.macports.org/ticket/32501#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X
#32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts -------------------------+------------------------- Reporter: chad@… | Owner: ciserlohn@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.0.3 Resolution: worksforme | Keywords: Port: erlang | -------------------------+------------------------- Comment (by chad@…): reinstalled latest versions of unixODBC, mysql-connector-odbc, mysql56-server and erlang, working perfectly now. no idea why it worked the second time around... thanks for investigating the problem! -- Ticket URL: <https://trac.macports.org/ticket/32501#comment:8> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts