Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jan 2015 14:03:02 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 197196] databases/freetds-devel: fix broken build and correct SIGBUS on tdsdbopen()
Message-ID:  <bug-197196-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197196

            Bug ID: 197196
           Summary: databases/freetds-devel: fix broken build and correct
                    SIGBUS on tdsdbopen()
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: bofh@freebsd.org
          Reporter: dg@fastmail.co.uk
             Flags: maintainer-feedback?(bofh@freebsd.org)
          Assignee: bofh@freebsd.org

port is currently marked BROKEN as the build fails with:

In file included from threadsafe.c:86:
../../include/freetds/tds.h:149:16: error: bit-field '__res_state' has
non-integral type 'TDS_USMALLINT (*())'
        TDS_USMALLINT _res:10;

/usr/include/resolv.h:282:16: note: expanded from macro '_res'
#define _res (*__res_state())

The offending line attempts to define a member of a bitfield named _res within
a typedef struct TDS_DATETIMEALL and fails as _res is defined a macro within
the included header resolv.h

The attached trivial patch temporarily ignores the macro definition for the
definition of TDS_USMALLINT only. #pragma push_macro() is an extension but is
supported by both clang and GCC. The patch is crude but succinct and
self-documenting.

Additionally both in the freetds and freetds-devel ports calls to tdsdbopen()
result in SIGBUS.

#0  0x000000080086b7e1 in tds_read_config_info (tds=0x801c42480,
login=0x6477702f6374652f, locale=0x801c20040) at config.c:176
#1  0x000000080082b3f3 in tdsdbopen (login=0x800bfcb7c, server=0x0, msdblib=1)
at dblib.c:1219
#2  0x000000080084b532 in dbopen (login=0x800bfcb7c, server=0x0) at dbopen.c:44
#3  0x0000000800bb01e4 in getpwent () from /lib/libc.so.7
#4  0x0000000800baf1b0 in getpwent_r () from /lib/libc.so.7
#5  0x0000000800bc2e2f in nsdispatch () from /lib/libc.so.7
#6  0x0000000800bafc1e in getpwuid_r () from /lib/libc.so.7
#7  0x000000080087ee76 in tds_get_homedir () at threadsafe.c:436
#8  0x000000080086d911 in tds_get_home_file (file=0x80089d3fd ".freetds.conf")
at config.c:320
#9  0x000000080086c723 in tds_read_conf_file (login=0x801c231e0,
server=0x801c201a8 "192.168.0.1:1234") at config.c:371
#10 0x000000080086b7f2 in tds_read_config_info (tds=0x801c42180,
login=0x801c23100, locale=0x801c20040) at config.c:176
#11 0x000000080082b3f3 in tdsdbopen (login=0x801c22058, server=0x401345
"192.168.0.1:1234", msdblib=1) at dblib.c:1219

Although I can't see an obvious flaw with the call to getwpuid_r at
threadsafe.c:436 a patch that disables this call and instead obtains the
homedir via getenv("HOME") prevents the problem and still allows configuration
files to be read from the home directory.

--- Comment #1 from Bugzilla Automation <bugzilla@FreeBSD.org> ---
Auto-assigned to maintainer bofh@freebsd.org

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-197196-13>