Seek error when libzip is compiled with CMake,
Re: Seek error when libzip is compiled with CMake,
- RE: Seek error when libzip is compiled with CMake, Boaz Stolk (2016/01/22 17:06:34)
- Re: Seek error when libzip is compiled with CMake, Thomas Klausner (2016/01/20 22:24:26)
Hi, I think I found the reason and a possible solution. zipconf.h defines ZIP_INT64_MIN as -0x8000000000000000LL, but comparing a positive zip_int64_t for smaller than (<) ZIP_INT64_MIN always evaluates to true!? This is exactly what is going on in _zip_fseek() at http://hg.nih.at/libzip/file/5a752916f919/lib/zip_source_filep.c#l490 If I cast ZIP_FSEEK_MIN to (zip_int64_t) here everything seems to work as expected. I think it may be related to something like this: http://stackoverflow.com/questions/8511598/large-negative-integer-literals I've also first tried your suggestion with largefile support, but that doesn't fix it. Also if I remove the AC_SYS_LARGEFILE from configure.ac and recompile using configure generated Makefiles the issue doesn't occur. However there must be a compiler setting, flag or generated file that is different from cmake, I'm just not able to find it.. This is the code I found on the Internet to define the appropriate _LARGE_FILES or _FILE_OFFSET_BITS: https://github.com/ufz/tiff/blob/master/cmake/Modules/AutoconfHelper.cmake#L126 (only the ac_sys_largefile function) Regards, Boaz -----Original Message----- From: Thomas Klausner [mailto:tk%giga.or.at@localhost] Sent: 20 January 2016 23:24 To: Boaz Stolk Cc: libzip-discuss%nih.at@localhost Subject: Re: Seek error when libzip is compiled with CMake On Wed, Jan 20, 2016 at 03:42:25PM +0000, Boaz Stolk wrote: > I am encountering the following issue when libzip is compiled with the > Makefiles that CMake has generated. > > When I do a zip_fopen_index on an (successfully opened archive), > zip_fopen_index returns NULL and the error is: Seek error: Value too large > for defined data type. > > Note that this does *not* occur when I build libzip using autoconf / > configure. > > System: > CentOS 6.6 (Final) > Kernel Linux 2.6.32-504.16.2.el6.x86_64 The intention was to provide CMake for Windows and let the other systems that can deal with it use the configure script, that's why you see problems like this. In this particular case, I think autoconf is smart enough to test for various #defines that might be necessary to get proper large file support (see --enable-largefile). I think it tries _FILE_OFFSET_BITS and _LARGE_FILES. I guess one or both might be needed on CentOS? If you are interested in this, perhaps you can come up with a patch for the cmake files that checks for these as well? Thanks, Thomas -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Made by MHonArc.