Bug 674 - libzip < 0.11 compatibility fix
Summary: libzip < 0.11 compatibility fix
Status: RESOLVED FIXED
Alias: None
Product: libsigrok
Classification: Unclassified
Component: Portability (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL: http://sigrok.org/gitweb/?p=libsigrok...
Keywords:
: 675 676 677 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-25 19:43 CET by Sönke Peters
Modified: 2015-10-30 15:44 CET (History)
2 users (show)



Attachments
Add zip_discard() macro when libzip < 0.11 (713 bytes, patch)
2015-10-25 19:43 CET, Sönke Peters
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Peters 2015-10-25 19:43:00 CET
Created attachment 169 [details]
Add zip_discard() macro when libzip < 0.11

This tiny patch makes libsigrok again compatible with libzip 0.10 by defining zip_discard() as an empty preprocessor macro.

libzip 0.10 is still in broad use, because long-term-support Linux distributions like Ubuntu 14.04 ship this version.
So I think it is quite important to be able to build libsigrok on these.

libzip >= 0.11 requirement was introduced in http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff;h=896fc9c7231c7567cda84404eb0fcdd889b556a2
due to the use of zip_discard() introduced in http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff;h=8d4097ffa69249be0fac8ab5d6a6e1e0b5fc368b

PS:
Thanks for your great work!
Comment 1 Daniel Elstner 2015-10-25 19:53:23 CET
Better to define zip_discard as zip_close to avoid leaks. This still won't deal with cleanup after failed write at close time, but I guess we can live with that.

However, I don't really like the idea of introducing a macro like that via AC_DEFINE(). I think it's better to use AC_CHECK_FUNCS() and use the generated HAVE_ZIP_DISCARD macro for a conditional in libsigrok-internal.h.
Comment 2 Daniel Elstner 2015-10-25 20:05:49 CET
*** Bug 677 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Elstner 2015-10-25 20:06:19 CET
*** Bug 675 has been marked as a duplicate of this bug. ***
Comment 4 Daniel Elstner 2015-10-25 20:07:15 CET
*** Bug 676 has been marked as a duplicate of this bug. ***
Comment 5 Sönke Peters 2015-10-25 20:08:33 CET
(In reply to comment #4)
> *** Bug 676 has been marked as a duplicate of this bug. ***

Sorry, for the duplicates! I've run into an "Internal Server Error" while posting.
Comment 6 Daniel Elstner 2015-10-25 20:19:44 CET
(In reply to comment #5)
> Sorry, for the duplicates! I've run into an "Internal Server Error" while
> posting.

No prob, everyone seems to get this at the moment. It appears that it works anyway, though.
Comment 7 Daniel Elstner 2015-10-25 21:05:54 CET
I just had another look at the libzip manual pages. It appears that the best way to replace zip_discard() is zip_unchange_all() followed by zip_close().

One way to go about this could be to implement a function which does that (e.g. sr_zip_discard()), and conditionally define zip_discard() to sr_zip_discard() if zip_discard() is not natively available.
Comment 8 Daniel Elstner 2015-10-30 14:10:18 CET
This should fix the problem:
https://github.com/danielkitta/libsigrok/commit/742b72ff2dfa12c3a627721f1566328c8eb157d9
Comment 11 Uwe Hermann 2015-10-30 15:44:06 CET
Fixed in a6dc3dacab23bf7c8da008f21a03e2a1242e77ea, thanks!