Control: tags -1 confirmed upstream

On Wed, Oct 07, 2015 at 11:40:41PM +0200, Andreas Beckmann wrote:
> Package: libodbc1
> Severity: important
> User: debian...@lists.debian.org
> Usertags: piuparts
> Control: affects -1 + pike7.8-odbc

> during a test with piuparts I noticed your package left unowned files on
> the system after purge, which is a violation of policy 6.8 (or 10.8):

> https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-removedetails

> Filing this as important as having a piuparts clean archive is a release
> goal since lenny.

> >From the attached log (scroll to the bottom...):

> 3m25.7s ERROR: FAIL: Package purging left files on system:
>   /etc/odbcinst.ini    not owned

> At least I assume that libodbc1 is responsible for the creation of this
> file.

libodbc1 is a library, the party responsible for the creation of the file is
arguably whoever invoked the library to create it.

In this case, this seems to be a rather strange side effect of pike's module
registration process.  The creation of /etc/odbcinst.ini appears to be done
in the iniOpen() function within libodbc, when called with bCreate=TRUE. 
There are a number of ODBC functions used by pike7.8-odbc that have this in
their call tree, including SQLAllocEnv() and SQLAllocConnect(), both of
which appear to be part of the pike module's initialization.

I think it's a bug that SQLAllocEnv() does this.  The
_SQLGetInstalledDrivers() function never writes to /etc/odbcinst.ini after
the initial O_CREAT.  So this seems to be a longstanding bug in the library
that went unnoticed, because most calls to SQLAllocEnv() are done on systems
that have actual odbc drivers available...

The attached patch seems to fix the problem, without causing any obvious
problems with libodbc itself.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
=== modified file 'debian/changelog'
--- a/debian/changelog	2014-04-30 00:35:56 +0000
+++ b/debian/changelog	2015-10-08 01:43:44 +0000
@@ -1,3 +1,10 @@
+unixodbc (2.3.1-4) UNRELEASED; urgency=medium
+
+  * odbcinst/_SQLGetInstalledDrivers.c: don't open /etc/odbcinst.ini for
+    writing when we never write to it.  Closes: #801258.
+
+ -- Steve Langasek <vor...@debian.org>  Thu, 08 Oct 2015 01:43:07 +0000
+
 unixodbc (2.3.1-3) unstable; urgency=low
 
   * DriverManager/SQLConnect.c: put a mutex around the call to

=== modified file 'odbcinst/_SQLGetInstalledDrivers.c'
--- a/odbcinst/_SQLGetInstalledDrivers.c	2013-05-29 23:13:30 +0000
+++ b/odbcinst/_SQLGetInstalledDrivers.c	2015-10-08 01:39:46 +0000
@@ -55,9 +55,9 @@
 
     /* PROCESS ODBC INI FILE */
 #ifdef __OS2__
-    if ( iniOpen( &hIni, szIniName, "#;", '[', ']', '=', 1, 1L ) != INI_SUCCESS )
+    if ( iniOpen( &hIni, szIniName, "#;", '[', ']', '=', FALSE, 1L ) != INI_SUCCESS )
 #else
-    if ( iniOpen( &hIni, szIniName, "#;", '[', ']', '=', 1 ) != INI_SUCCESS )
+    if ( iniOpen( &hIni, szIniName, "#;", '[', ']', '=', FALSE ) != INI_SUCCESS )
 #endif
     {
         inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, ODBC_ERROR_COMPONENT_NOT_FOUND, "" );

Reply via email to