Package: mdbtools
Version: 0.7.1-5
Severity: normal

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate
***

   * What led up to the situation?

I've tried to export the schema of a Microsoft Access Database (MDB) file
as SQL text. The MDB file size is 2147483648 bytes (2GByte).

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

I have used the following comman ds given as a regular user:

$ ls -lha *.mdb
-rwxrwxrwx 1 root root 2,0G gen 22 21:05 test.mdb

$ file test.mdb
test.mdb: Microsoft Access Database

$ mdb-schema ./test.mdb mysql
File not found
Could not open file

As you can see, the command mdb-schema fails without reason.

I have traced the error using gdb up to the failure of function
stat() in the source file mdbtools-0.7.1/src/libmdb/file.c at
line 121:

   105  /**
   106   * mdb_find_file:
   107   * @filename: path to MDB (database) file
   108   *
   109   * Finds and returns the absolute path to an MDB file.  Function
will first try
   110   * to fstat file as passed, then search through the $MDBPATH if not
found.
   111   *
   112   * Return value: gchar pointer to absolute path. Caller is
responsible for
   113   * freeing.
   114   **/
   115  static char *mdb_find_file(const char *file_name)
   116  {
   117          struct stat status;
   118          gchar *mdbpath, **dir, *tmpfname;
   119          unsigned int i = 0;

   120          /* try the provided file name first */
   121          if (!stat(file_name, &status)) {
   122                  char *result;
   123                  result = g_strdup(file_name);
   124                  if (!result)
   125                          fprintf(stderr, "Can't alloc filename\n");
   126                  return result;
   127          }

The stat(..) function fails with error code "EOVERFLOW",due to overflow
in fields of struct stat caused by file size greater 2G because the
package is compiled for 32 bit (i386) architeture.

This can be overcomed rebuilding mdbtools package using the
_FILE_OFFSET_BITS=64 and _LARGEFILE64_SOURCE compiler options as
reported by stat() linux man page; for example:

$ su -c "apt-get source mdbtools"
$ su -c "apt-get build-dep mdbtools"
$ cd mdbtools-0.7.1
$ DEB_BUILD_OPTIONS='nostrip noopt debug' \
    CFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE' \
    dpkg-buildpackage -b -uc -us
$ su -c "dpkg -i ../*.deb"

Can these compiler options (CFLAGS='-D_FILE_OFFSET_BITS=64
-D_LARGEFILE64_SOURCE') be included in Debian 32 bit (i386)
standard packaging ?

   * What was the outcome of this action?

The SQL schema was not generated, the error "file not found" was shown,
instead.

After rebuilding the pacakge with _FILE_OFFSET_BITS=64 and
_LARGEFILE64_SOURCE compiler options, the mdb-schema program correctly
opened the MDB file with size greater than 2 GByte on 32 bit (i386)
architecture.

   * What outcome did you expect instead?

The SQL schema was expected on /dev/stdout.

After rebuilding the pacakge with _FILE_OFFSET_BITS=64 and
_LARGEFILE64_SOURCE compiler options, the mdb-schema program correctly
opened the MDB file with size greater than 2 GByte on 32 bit (i386)
architecture.

*** End of the template - remove these template lines ***


-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 4.14.0-1-686-pae (SMP w/1 CPU core)
Locale: LANG=it_IT.utf8, LC_CTYPE=it_IT.utf8 (charmap=UTF-8),
LANGUAGE=it_IT.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mdbtools depends on:
ii  libc6         2.25-5
ii  libglib2.0-0  2.54.2-4
ii  libmdb2       0.7.1-5
ii  libmdbsql2    0.7.1-5
ii  libreadline7  7.0-3

mdbtools recommends no packages.

Versions of packages mdbtools suggests:
ii  bash-completion  1:2.1-4.3
pn  mdbtools-doc     <none>

-- no debconf information

Reply via email to