[MacPorts] #32501: erlang @R14B04 +odbc Patch for bug in Erlang ODBC configure scripts

MacPorts noreply at macports.org
Sat Dec 10 23:02:45 PST 2011


#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 at 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 at scratch)1> odbc:start().
 ok
 (alaem at scratch)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []).
 {ok,<0.90.0>}
 (alaem at scratch)3> odbc:describe_table(Ref, "foo").
 {ok,[{"bar",{sql_wvarchar,255}}]}
 (alaem at scratch)4> odbc:select_count(Ref, "SELECT * FROM foo").
 {ok,1}
 (alaem at scratch)5> {selected, Columns, [{Bar}]} = odbc:next(Ref).
 {selected,["bar"],[{<<98,0,97,0,122,0>>}]}
 (alaem at scratch)6> unicode:characters_to_list(Bar, {utf16, little}).
 "baz"
 (alaem at scratch)7> unicode:characters_to_list(Bar, {utf32, little}).
 {error,[],<<98,0,97,0,122,0>>}

 OS X ERLANG SESSION:

 (alaem at colossus)1> odbc:start().
 ok
 (alaem at colossus)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []).
 {ok,<0.90.0>}
 (alaem at colossus)3> odbc:describe_table(Ref, "foo").
 {ok,[{"bar",{sql_wvarchar,255}}]}
 (alaem at colossus)4> odbc:select_count(Ref, "SELECT * FROM foo").
 {ok,1}
 (alaem at colossus)5> {selected, Columns, [{Bar}]} = odbc:next(Ref).
 {selected,["bar"],[{<<98,0,0,0,97,0,0,0,122,0,0,0>>}]}
 (alaem at colossus)6> unicode:characters_to_list(Bar, {utf16, little}).
 [98,0,97,0,122,0]
 (alaem at 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


More information about the macports-tickets mailing list