From 7467ad249620d1e103a086fc47232c5393184523 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 9 Nov 2024 01:53:45 +0100 Subject: [PATCH] updated url, specfile fixes, upstream patches applied; closes #1 [release 1.26-2mamba;Fri Nov 08 2024] --- flickcurl-1.26-gcc-14.patch | 336 +++++++++++++++++++ flickcurl-1.26-upstream-fix-doublefree.patch | 173 ++++++++++ flickcurl-1.26-upstream-fix-off-by-one.patch | 22 ++ flickcurl-1.26-upstream-fix-tokeninit.patch | 37 ++ flickcurl-1.26-upstream-fixargparsing.patch | 32 ++ flickcurl.spec | 34 +- 6 files changed, 624 insertions(+), 10 deletions(-) create mode 100644 flickcurl-1.26-gcc-14.patch create mode 100644 flickcurl-1.26-upstream-fix-doublefree.patch create mode 100644 flickcurl-1.26-upstream-fix-off-by-one.patch create mode 100644 flickcurl-1.26-upstream-fix-tokeninit.patch create mode 100644 flickcurl-1.26-upstream-fixargparsing.patch diff --git a/flickcurl-1.26-gcc-14.patch b/flickcurl-1.26-gcc-14.patch new file mode 100644 index 0000000..f4d96aa --- /dev/null +++ b/flickcurl-1.26-gcc-14.patch @@ -0,0 +1,336 @@ +From 96f263150cf025bdcf969fc9884cc90a466f54fb Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Mon, 6 May 2024 09:28:24 +0100 +Subject: [PATCH] Fix -Wimplicit-function-declaration + +GCC 14 and Clang 16 make this fatal by default. + +Bug: https://bugs.gentoo.org/927191 +--- + src/activity.c | 1 + + src/args.c | 1 + + src/blog.c | 1 + + src/category.c | 1 + + src/collection.c | 1 + + src/comments.c | 1 + + src/contacts.c | 1 + + src/context.c | 1 + + src/exif.c | 1 + + src/gallery.c | 1 + + src/group.c | 1 + + src/legacy-auth.c | 1 + + src/members.c | 1 + + src/method.c | 1 + + src/note.c | 1 + + src/oauth.c | 1 + + src/perms.c | 1 + + src/photo.c | 1 + + src/photoset.c | 1 + + src/sha1.c | 1 + + src/size.c | 1 + + src/stat.c | 1 + + src/tags.c | 1 + + src/ticket.c | 1 + + src/user_upload_status.c | 1 + + 25 files changed, 25 insertions(+) + +diff --git a/src/activity.c b/src/activity.c +index 8c4e9198..27c4f5d1 100644 +--- a/src/activity.c ++++ b/src/activity.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/args.c b/src/args.c +index 18ab1ca4..77a7128e 100644 +--- a/src/args.c ++++ b/src/args.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/blog.c b/src/blog.c +index db53c1a4..3243734e 100644 +--- a/src/blog.c ++++ b/src/blog.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/category.c b/src/category.c +index 866955e6..a5c86205 100644 +--- a/src/category.c ++++ b/src/category.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/collection.c b/src/collection.c +index 1014d2ba..1f2ffce8 100644 +--- a/src/collection.c ++++ b/src/collection.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/comments.c b/src/comments.c +index a362897a..246a7ced 100644 +--- a/src/comments.c ++++ b/src/comments.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/contacts.c b/src/contacts.c +index 61889af7..1992823b 100644 +--- a/src/contacts.c ++++ b/src/contacts.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/context.c b/src/context.c +index 703dbeef..8ec98f0e 100644 +--- a/src/context.c ++++ b/src/context.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/exif.c b/src/exif.c +index 2b71dc1e..b4379e17 100644 +--- a/src/exif.c ++++ b/src/exif.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/gallery.c b/src/gallery.c +index d7011b35..a6acb4a4 100644 +--- a/src/gallery.c ++++ b/src/gallery.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/group.c b/src/group.c +index 0cf7d824..48d4146e 100644 +--- a/src/group.c ++++ b/src/group.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/legacy-auth.c b/src/legacy-auth.c +index 9815d94c..b9e196ea 100644 +--- a/src/legacy-auth.c ++++ b/src/legacy-auth.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/members.c b/src/members.c +index 7d9849c0..01482d8e 100644 +--- a/src/members.c ++++ b/src/members.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/method.c b/src/method.c +index 11a12195..42de9010 100644 +--- a/src/method.c ++++ b/src/method.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/note.c b/src/note.c +index 5edaf364..fc685058 100644 +--- a/src/note.c ++++ b/src/note.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/oauth.c b/src/oauth.c +index 95f09a24..8be4963e 100644 +--- a/src/oauth.c ++++ b/src/oauth.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/perms.c b/src/perms.c +index e82fb0ea..64c31df2 100644 +--- a/src/perms.c ++++ b/src/perms.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/photo.c b/src/photo.c +index 8fa5e872..f6db2eb8 100644 +--- a/src/photo.c ++++ b/src/photo.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + + #ifdef HAVE_CONFIG_H +diff --git a/src/photoset.c b/src/photoset.c +index 2bd14a94..3831472c 100644 +--- a/src/photoset.c ++++ b/src/photoset.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/sha1.c b/src/sha1.c +index bcc281d2..5712abd5 100644 +--- a/src/sha1.c ++++ b/src/sha1.c +@@ -92,6 +92,7 @@ A million repetitions of "a" + #include + #include + #include ++#include + + #include + #include +diff --git a/src/size.c b/src/size.c +index 2b6154c3..50e45e35 100644 +--- a/src/size.c ++++ b/src/size.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/stat.c b/src/stat.c +index 69c98270..19fc610b 100644 +--- a/src/stat.c ++++ b/src/stat.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/tags.c b/src/tags.c +index 240c6996..440a5319 100644 +--- a/src/tags.c ++++ b/src/tags.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/ticket.c b/src/ticket.c +index 816de8cc..b976b757 100644 +--- a/src/ticket.c ++++ b/src/ticket.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include +diff --git a/src/user_upload_status.c b/src/user_upload_status.c +index a7457ad3..e89a2f58 100644 +--- a/src/user_upload_status.c ++++ b/src/user_upload_status.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include diff --git a/flickcurl-1.26-upstream-fix-doublefree.patch b/flickcurl-1.26-upstream-fix-doublefree.patch new file mode 100644 index 0000000..dea816f --- /dev/null +++ b/flickcurl-1.26-upstream-fix-doublefree.patch @@ -0,0 +1,173 @@ +From a5cc2a5d2fc7074f50fbaa772232b6e0fea7ce89 Mon Sep 17 00:00:00 2001 +From: Dave Beckett +Date: Sun, 25 Jan 2015 15:44:27 -0800 +Subject: [PATCH] Make form use/free api saner and prevent double free. Fixes + Issue #28 + +--- + src/common.c | 31 +++++++++++++++++++++---------- + src/flickcurl_internal.h | 2 +- + src/oauth.c | 34 ++++++++++++++++++---------------- + 3 files changed, 40 insertions(+), 27 deletions(-) + +diff --git a/src/common.c b/src/common.c +index 1fcc67d8..348c78fe 100644 +--- a/src/common.c ++++ b/src/common.c +@@ -1516,14 +1516,18 @@ flickcurl_invoke_get_content(flickcurl *fc, size_t* size_p) + } + + ++/* ++ * INTERNAL - free a form. ++ */ + void +-flickcurl_free_form(char **form, int count) ++flickcurl_free_form(char **form) + { + if(!form) + return; + + /* free content which is the first key */ +- free(form[0]); ++ if(form[0]) ++ free(form[0]); + + free(form); + } +@@ -1537,10 +1541,16 @@ flickcurl_free_form(char **form, int count) + * INTERNAL - decoded content from current request as HTTP FORM and return fields + * + * NOTE: The result may be an empty array with just two NULL +-* terminating pointers if there are no fields. ++* terminating pointers if there are no fields or no content. ++* ++* If @count_p is not NULL, *@count_p is set to the number of pairs of ++* fields. ++* ++* Index 0 is used to store the raw content. ++* ++* Return value: NULL on failure or an array of [char* field name, ++* char* field value] starting at index 1, terminated by a NULL pair. + * +-* Return value: array of [char* field name, char* field value] with +-* NULL pair terminating or NULL on failure + */ + char** + flickcurl_invoke_get_form_content(flickcurl *fc, int* count_p) +@@ -1562,21 +1572,24 @@ flickcurl_invoke_get_form_content(flickcurl *fc, int* count_p) + count++; /* counting separators so need +1 for number of contents */ + } + +- /* Allocate count + 1 sized array of char* (key, value) pointers ++ /* Allocate 1+ count + 1 sized array of char* (key, value) pointers + * The last pair are always (NULL, NULL). + * + * The pointers are into the 'content' buffer which is kept around + * and owned by this array and stored in form[0]. + */ +- form = (char**)calloc(2*(count + 1), sizeof(char*)); ++ form = (char**)calloc(1 + 2*(count + 1), sizeof(char*)); + if(!form) { + if(content) + free(content); + return NULL; + } + ++ /* the form owns the content array */ ++ form[0] = content; ++ + if(content) { +- for(p = content, i = 0; *p; p++) { ++ for(p = content, i = 1; *p; p++) { + char *start = p; + + while(*p && *p != '&' && *p != '=') +@@ -1590,8 +1603,6 @@ flickcurl_invoke_get_form_content(flickcurl *fc, int* count_p) + } + form[i++] = NULL; + form[i] = NULL; +- +- free(content); + } + + if(count_p) +diff --git a/src/flickcurl_internal.h b/src/flickcurl_internal.h +index 4904341c..30829789 100644 +--- a/src/flickcurl_internal.h ++++ b/src/flickcurl_internal.h +@@ -119,7 +119,7 @@ xmlDocPtr flickcurl_invoke(flickcurl *fc); + char* flickcurl_invoke_get_content(flickcurl *fc, size_t* size_p); + /* Invoke URI prepared above and get back 'count' key/values */ + char** flickcurl_invoke_get_form_content(flickcurl *fc, int* count_p); +-void flickcurl_free_form(char **form, int count); ++void flickcurl_free_form(char **form); + + /* args.c */ + void flickcurl_free_arg(flickcurl_arg *arg); +diff --git a/src/oauth.c b/src/oauth.c +index d1f649e3..8ac4e3c1 100644 +--- a/src/oauth.c ++++ b/src/oauth.c +@@ -741,11 +741,12 @@ flickcurl_oauth_create_request_token(flickcurl* fc, const char* callback) + uri, count); + #endif + +- for(i = 0; i < (2 * count); i += 2) { +- if(!strcmp(form[i], "oauth_token")) { +- request_token = form[i+1]; +- } else if(!strcmp(form[i], "oauth_token_secret")) { +- request_token_secret = form[i+1]; ++ for(i = 0; i < count; i++) { ++ int offset = 1 + (2 * i); ++ if(!strcmp(form[offset], "oauth_token")) { ++ request_token = form[offset+1]; ++ } else if(!strcmp(form[offset], "oauth_token_secret")) { ++ request_token_secret = form[offset+1]; + } + } + +@@ -771,7 +772,7 @@ flickcurl_oauth_create_request_token(flickcurl* fc, const char* callback) + + tidy: + if(form) +- flickcurl_free_form(form, count); ++ flickcurl_free_form(form); + + return rc; + } +@@ -888,15 +889,16 @@ flickcurl_oauth_create_access_token(flickcurl* fc, const char* verifier) + uri, count); + #endif + +- for(i = 0; i < (2 * count); i += 2) { +- if(!strcmp(form[i], "oauth_token")) { +- access_token = form[i+1]; +- } else if(!strcmp(form[i], "oauth_token_secret")) { +- access_token_secret = form[i+1]; +- } else if(!strcmp(form[i], "username")) { +- username = form[i+1]; +- } else if(!strcmp(form[i], "user_nsid")) { +- user_nsid = form[i+1]; ++ for(i = 0; i < count; i++) { ++ int offset = 1 + (2 * i); ++ if(!strcmp(form[offset], "oauth_token")) { ++ access_token = form[offset+1]; ++ } else if(!strcmp(form[offset], "oauth_token_secret")) { ++ access_token_secret = form[offset+1]; ++ } else if(!strcmp(form[offset], "username")) { ++ username = form[offset+1]; ++ } else if(!strcmp(form[offset], "user_nsid")) { ++ user_nsid = form[offset+1]; + } + /* ignoring: fullname */ + } +@@ -952,7 +954,7 @@ flickcurl_oauth_create_access_token(flickcurl* fc, const char* verifier) + + tidy: + if(form) +- flickcurl_free_form(form, count); ++ flickcurl_free_form(form); + + return rc; + } diff --git a/flickcurl-1.26-upstream-fix-off-by-one.patch b/flickcurl-1.26-upstream-fix-off-by-one.patch new file mode 100644 index 0000000..1fc52df --- /dev/null +++ b/flickcurl-1.26-upstream-fix-off-by-one.patch @@ -0,0 +1,22 @@ +From a99721524c3ad1afa128e9ec492921abc4bac1ff Mon Sep 17 00:00:00 2001 +From: Dave Beckett +Date: Sun, 18 Jan 2015 10:42:54 -0800 +Subject: [PATCH] (flickcurl_array_join): Do not add trailing , closes #27 + +--- + src/common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/common.c b/src/common.c +index e32f856e..1fcc67d8 100644 +--- a/src/common.c ++++ b/src/common.c +@@ -1934,7 +1934,7 @@ flickcurl_array_join(const char *array[], char delim) + size_t item_len = strlen(array[i]); + memcpy(p, array[i], item_len); + p += item_len; +- if(i < array_size) ++ if(i < array_size - 1) + *p++ = delim; + } + *p = '\0'; diff --git a/flickcurl-1.26-upstream-fix-tokeninit.patch b/flickcurl-1.26-upstream-fix-tokeninit.patch new file mode 100644 index 0000000..7317ff8 --- /dev/null +++ b/flickcurl-1.26-upstream-fix-tokeninit.patch @@ -0,0 +1,37 @@ +From cce202afcf820918891251e1fa3801c7931b73ee Mon Sep 17 00:00:00 2001 +From: Dave Beckett +Date: Thu, 28 May 2015 21:57:26 -0700 +Subject: [PATCH] Properly initialize oauth request/access token call params + +(flickcurl_oauth_create_request_token, +flickcurl_oauth_create_access_token): Call flickcurl_init_params to init +params, not flickcurl_end_params + +This closes #30 +https://github.com/dajobe/flickcurl/issues/30 +--- + src/oauth.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/oauth.c b/src/oauth.c +index 8ac4e3c1..95f09a24 100644 +--- a/src/oauth.c ++++ b/src/oauth.c +@@ -709,7 +709,7 @@ flickcurl_oauth_create_request_token(flickcurl* fc, const char* callback) + int i; + int count; + +- flickcurl_end_params(fc); ++ flickcurl_init_params(fc, 0); + + /* Require signature */ + flickcurl_set_sign(fc); +@@ -857,7 +857,7 @@ flickcurl_oauth_create_access_token(flickcurl* fc, const char* verifier) + if(!verifier) + return 1; + +- flickcurl_end_params(fc); ++ flickcurl_init_params(fc, 0); + + /* Require signature */ + flickcurl_set_sign(fc); diff --git a/flickcurl-1.26-upstream-fixargparsing.patch b/flickcurl-1.26-upstream-fixargparsing.patch new file mode 100644 index 0000000..1325b1e --- /dev/null +++ b/flickcurl-1.26-upstream-fixargparsing.patch @@ -0,0 +1,32 @@ +From b2d64c8289ef519e5265a73148b650b053cc0ae6 Mon Sep 17 00:00:00 2001 +From: Dave Beckett +Date: Sun, 31 May 2015 20:29:00 -0700 +Subject: [PATCH] collections.getTree - handle now args case. Closes #31 + +--- + utils/commands.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/utils/commands.c b/utils/commands.c +index fe3a05e3..dca6bba2 100644 +--- a/utils/commands.c ++++ b/utils/commands.c +@@ -3749,10 +3749,14 @@ command_collections_getTree(flickcurl* fc, int argc, char *argv[]) + char *user_id = NULL; + flickcurl_collection *collection = NULL; + +- if(strcmp(argv[1], "-")) +- collection_id = argv[1]; +- if(strcmp(argv[2], "-")) +- user_id = argv[2]; ++ if(argc >1) { ++ if(strcmp(argv[1], "-")) ++ collection_id = argv[1]; ++ if(argc >2) { ++ if(strcmp(argv[2], "-")) ++ user_id = argv[2]; ++ } ++ } + + collection = flickcurl_collections_getTree(fc, collection_id, user_id); + if(collection) { diff --git a/flickcurl.spec b/flickcurl.spec index b329edf..968fd34 100644 --- a/flickcurl.spec +++ b/flickcurl.spec @@ -1,25 +1,29 @@ Name: flickcurl Version: 1.26 -Release: 1mamba +Release: 2mamba Summary: Library for the Flickr API Group: Applications/Graphics Vendor: openmamba Distribution: openmamba -Packager: Davide Madrisan -URL: http://librdf.org/flickcurl/ +Packager: Silvan Calarco +URL: https://librdf.org/flickcurl/ Source: http://download.dajobe.org/flickcurl/flickcurl-%{version}.tar.gz +Patch0: flickcurl-1.26-upstream-fix-off-by-one.patch +Patch1: flickcurl-1.26-upstream-fix-doublefree.patch +Patch2: flickcurl-1.26-upstream-fix-tokeninit.patch +Patch3: flickcurl-1.26-upstream-fixargparsing.patch +Patch4: flickcurl-1.26-gcc-14.patch License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel -BuildRequires: gtk-doc BuildRequires: libcurl-devel +BuildRequires: libicu-devel +BuildRequires: liblzma-devel BuildRequires: libraptor2-devel BuildRequires: libxml2-devel -#p AUTOBUILDREQ-END +BuildRequires: libz-devel +## AUTOBUILDREQ-END Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} -BuildRoot: %{_tmppath}/%{name}-%{version}-root - -%debug_package %description Flickcurl is a C library for the Flickr API, handling creating the requests, signing, token management, calling the API, marshalling request parameters and decoding responses. @@ -51,11 +55,19 @@ Requires: gtk-doc %description apidocs This package includes the %{name} API documentation. +%debug_package + %prep %setup -q +%patch 0 -p1 -b .upstream-fix-off-by-one +%patch 1 -p1 -b .upstream-fix-doublefree +%patch 2 -p1 -b .upstream-fix-tokeninit +%patch 3 -p1 -b .upstream-fixargparsing +%patch 4 -p1 -b .gcc-14 %build -%configure --disable-static --enable-gtk-doc +%configure --disable-static + %make %install @@ -84,7 +96,6 @@ This package includes the %{name} API documentation. %defattr(-,root,root) %{_bindir}/flickcurl-config %{_includedir}/flickcurl.h -%{_libdir}/libflickcurl.la %{_libdir}/libflickcurl.so %{_libdir}/pkgconfig/flickcurl.pc %{_mandir}/man1/flickcurl-config.* @@ -95,6 +106,9 @@ This package includes the %{name} API documentation. %{_datadir}/gtk-doc/html/%{name} %changelog +* Fri Nov 08 2024 Silvan Calarco 1.26-2mamba +- updated url, specfile fixes, upstream patches applied; closes #1 + * Fri Aug 22 2014 Automatic Build System 1.26-1mamba - automatic version update by autodist