FIY: libzip and UTF-8 on Win32

Thiago Macieira thiago at macieira.org
Sun Feb 22 13:11:52 PST 2015


On Saturday 21 February 2015 01:14:00 Lubomir I. Ivanov wrote:
> On 20 February 2015 at 22:13, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> > but...after building Subsurface with the new libzip it gives me
> > "Archive cannot be opened. Bad file descriptor" when download from
> > divelogs.de.
> > i need to investigate.
> 
> spent a couple of hours on this one.
> 
> CCing Thiago - the QTemporaryFile file locks in a way that the new
> libzip WINAPI support cannot use zip_open()
> on said file. could this be a LockFile / UnlockFile() API related
> semantic in Qt 5.3.0? or am i missing something else?

I don't see any big change to QTemporaryFile since before 5.0. The only big 
thing since then is WinRT support, but that's behind #ifdef so it wouldn't 
trigger on regular, desktop Windows.

QSettings does use lock files and temporary files, but that doesn't affect 
QTemporaryFile.

temp files are also created readable and sharable:

        file = CreateFile((const wchar_t *)path.constData(),
                GENERIC_READ | GENERIC_WRITE,
                FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_NEW,
                FILE_ATTRIBUTE_NORMAL, NULL);

> Doing a close() doesn't unlock the file, but a rename() does.

That might be because close() doesn't really close but rename() does.

So we know that actually closing the file handle solves the problem, but we 
don't know what caused it.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the subsurface mailing list