Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 280408 - dev-db/unixODBC-2.2.12: odbcinst -j reports wrong directories if either LD_LIBRARY_PATH or ODBCSYSINI is not set
Summary: dev-db/unixODBC-2.2.12: odbcinst -j reports wrong directories if either LD_LI...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-05 06:17 UTC by Michael Yang
Modified: 2010-07-10 15:05 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Yang 2009-08-05 06:17:11 UTC
dev-db/unixODBC-2.2.12: odbcinst utility is used to install odbc connection drivers (e.g. FreeTDS) into files odbcinst.ini, odbc.ini, and .odbc.ini as in the following command:

$ odbcinst -i -d -f driverfile

where driverfile contains the details of the where to find the odbc driver library e.g. FreeTDS.

A prefix installation on a system with unixODBC already installed by root  will use /usr/lib/libodbcinst.so rather than $EPREFIX/usr/lib/libodbcinst.so unless LD_LIBRARY_PATH is explicitly set to $EPREFIX/usr/lib or ODBCSYSINI environment variable is set to $EPREFIX/etc/unixODBC.  If either of these environment variables are not set, then odbcinst -j will report /etc/* directories, and driver installation will fail.

Reproducible: Always

Steps to Reproduce:
1. install unixODBC as root
2. prefix emerge unixODBC
3. unset LD_LIBRARY_PATH ODBCSYSINI
4. odbcinst -i -d -f driver.temp

where driver.temp is something like:

[FreeTDS]
Description = v0.64 with protocol v8.0
Driver = ${EPREFIX}/usr/lib/libtdsodbc.so
Actual Results:  
odbcinst: SQLInstallDriverEx failed with Invalid install path.

Expected Results:  
odbcinst: Driver installed. Usage count increased to 1. 
    Target directory is ${EPREFIX}/etc/unixODBC

$ odbcinst -j will report locations of the driver and system/user data sources.

exe/odbcinst.c is using function odbcinst_system_file_path() which is defined in odbcinst/_odbcinst_SystemINI.c, compiled into libodbcinst.la during build,  linked with odbcinst.o to produce exe/.libs/odbcinst which is ultimately installed to $EPREFIX/usr/bin/

odbcinst/_odbcinst_SystemINI.c looks for environment variable ODBCSYSINI and, if not found, reports /etc/*

Note:  some further debugging revealed that exe/odbcinst is an extra build-only utility that sets the LD_LIBRARY_PATH value pointing to the odbcinst/.libs/libodbcinst.so so that exe/.libs/odbcinst reports the correct odbcinst.ini locations.  However, post-build, the odbcinst utility will not work correctly on its own without setting the proper environment variables.
Comment 1 Michael Yang 2009-08-05 06:29:39 UTC
note: ebuild compile DOES correctly use the -DSYSTEM_FILE_PATH=\"${EPREFIX}/etc/unixODBC\" define flag, which builds a correctly working odbcinst_system_file_path() in $EPREFIX/usr/lib/libodbcinst.so

but maybe a better fix is to patch odbcinst/_odbcinst_SystemINI.c so that it  returns "$EPREFIX/etc/unixODBC" all the time when odbcinst_system_file_path() is called.
Comment 2 Samuli Suominen (RETIRED) gentoo-dev 2010-03-22 15:17:30 UTC
just fyi, unixODBC-2.2.14 is in main tree now.
Comment 3 Samuli Suominen (RETIRED) gentoo-dev 2010-04-24 16:29:32 UTC
2.3.0 in tree, can we get a update if the problem persists?
Comment 4 Fabian Groffen gentoo-dev 2010-04-24 16:33:42 UTC
we are directly on gx86 for this one, so what's in the main tree is in our tree
Comment 5 Fabian Groffen gentoo-dev 2010-07-10 15:05:20 UTC
I just fixed this issue, it was because inidir was set by default, and hence not prefixed.

Your example worked for me correctly now with dev-db/unixODBC-2.3.0