From 9fcd9687814f12770487d03dd0a61d42fc6ad693 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 6 Jun 2018 15:41:51 +0300 Subject: Merge with 1.4.2 upstream package version --- COPYING | 2 +- TODO | 4 ++-- build/bootstrap.build | 13 ++++++------- libpkgconf/fragment.c | 54 +++++++++++++++++++++++++++++++-------------------- libpkgconf/pkg.c | 33 ++++++++++++++++++++++++++----- manifest | 2 +- 6 files changed, 71 insertions(+), 37 deletions(-) diff --git a/COPYING b/COPYING index 81a5221..35c7c16 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 +Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 pkgconf authors (see AUTHORS file in source directory). Permission to use, copy, modify, and/or distribute this software for any diff --git a/TODO b/TODO index 69d3589..cbaedea 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ -@@ What is a project email (update the manifest file)? Using personal email of - one of the developers for now. +@@ What is a project email (update the manifest file)? Using + packaging@build2.org for now. @@ Consider redefining PKGCONF_BUFSIZE from the current 65535 bytes to something smaller, given it is used to allocate buffers on the stack diff --git a/build/bootstrap.build b/build/bootstrap.build index 57fd2bd..e51f606 100644 --- a/build/bootstrap.build +++ b/build/bootstrap.build @@ -11,13 +11,12 @@ using test using install # The versioning scheme (after 0.9.12) assumes that each [major?] release has -# it's own number (starting with 2). In any case, as of 1.3.9, version 2 is -# still in the library file name (libpkgconf.so.2.0.0). This probably means -# that the release number is equal to major version + 1 (though in Makefile.am -# they use -version-info 2:0:0 which doesn't mean what they think it means). Or -# it can mean that the first two release version components constitute a major -# version, and the release number increments each time this version changes. -# So we just need to watch their Makefile.am for any changes. +# it's own number (starting with 2). In any case, for the 1.3.90 to 1.4.0 +# release version increment the version in the library file name changed from +# 2 to 3 (libpkgconf.so.2.0.0 -> libpkgconf.so.3.0.0). This probably means +# that the first two release version components constitute a major version, +# and the release number increments each time this version changes. So we just +# need to watch their Makefile.am for any changes. # # See also: http://kaniini.dereferenced.org/2015/07/20/pkgconf-0-9-12-and-future.html # diff --git a/libpkgconf/fragment.c b/libpkgconf/fragment.c index 1ea91ee..5b686f5 100644 --- a/libpkgconf/fragment.c +++ b/libpkgconf/fragment.c @@ -386,15 +386,19 @@ pkgconf_fragment_filter(const pkgconf_client_t *client, pkgconf_list_t *dest, pk } } -static inline bool -fragment_should_quote(const pkgconf_fragment_t *frag) +static inline char * +fragment_quote(const pkgconf_fragment_t *frag) { - const char *src; + const char *src = frag->data; + ssize_t outlen = strlen(src) + 10; + char *out, *dst; if (frag->data == NULL) - return false; + return NULL; + + out = dst = calloc(outlen, 1); - for (src = frag->data; *src; src++) + for (; *src; src++) { if (((*src < ' ') || (*src >= (' ' + (frag->merged ? 1 : 0)) && *src < '$') || @@ -406,10 +410,19 @@ fragment_should_quote(const pkgconf_fragment_t *frag) (*src == '`') || (*src > 'z' && *src < '~') || (*src > '~'))) - return true; + *dst++ = '\\'; + + *dst++ = *src; + + if ((ptrdiff_t)(dst - out) + 2 > outlen) + { + outlen *= 2; + out = realloc(out, outlen); + } } - return false; + *dst = 0; + return out; } static inline size_t @@ -422,10 +435,9 @@ pkgconf_fragment_len(const pkgconf_fragment_t *frag) if (frag->data != NULL) { - len += strlen(frag->data); - - if (fragment_should_quote(frag)) - len += 2; + char *quoted = fragment_quote(frag); + len += strlen(quoted); + free(quoted); } return len; @@ -462,13 +474,13 @@ fragment_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, bool e { const pkgconf_fragment_t *frag = node->data; size_t buf_remaining = buflen - (bptr - buf); - bool should_quote = fragment_should_quote(frag); + char *quoted = fragment_quote(frag); - if (pkgconf_fragment_len(frag) > buf_remaining) + if (strlen(quoted) > buf_remaining) + { + free(quoted); break; - - if (should_quote) - *bptr++ = '\''; + } if (frag->type) { @@ -476,11 +488,11 @@ fragment_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, bool e *bptr++ = frag->type; } - if (frag->data) - bptr += pkgconf_strlcpy(bptr, frag->data, buf_remaining); - - if (should_quote) - *bptr++ = '\''; + if (quoted != NULL) + { + bptr += pkgconf_strlcpy(bptr, quoted, buf_remaining); + free(quoted); + } *bptr++ = ' '; } diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index 6918d6d..0feb4d6 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -884,15 +884,25 @@ static pkgconf_pkg_t pkg_config_virtual = { .flags = PKGCONF_PKG_PROPF_STATIC, .vars = { .head = &(pkgconf_node_t){ - .prev = NULL, - .next = NULL, + .next = &(pkgconf_node_t){ + .next = &(pkgconf_node_t){ + .data = &(pkgconf_tuple_t){ + .key = "pc_system_libdirs", + .value = SYSTEM_LIBDIR, + } + }, + .data = &(pkgconf_tuple_t){ + .key = "pc_system_includedirs", + .value = SYSTEM_INCLUDEDIR, + } + }, .data = &(pkgconf_tuple_t){ .key = "pc_path", .value = PKG_DEFAULT_PATH, }, }, .tail = NULL, - }, + } }; static pkgconf_pkg_t pkgconf_virtual = { @@ -904,8 +914,18 @@ static pkgconf_pkg_t pkgconf_virtual = { .flags = PKGCONF_PKG_PROPF_STATIC, .vars = { .head = &(pkgconf_node_t){ - .prev = NULL, - .next = NULL, + .next = &(pkgconf_node_t){ + .next = &(pkgconf_node_t){ + .data = &(pkgconf_tuple_t){ + .key = "pc_system_libdirs", + .value = SYSTEM_LIBDIR, + } + }, + .data = &(pkgconf_tuple_t){ + .key = "pc_system_includedirs", + .value = SYSTEM_INCLUDEDIR, + } + }, .data = &(pkgconf_tuple_t){ .key = "pc_path", .value = PKG_DEFAULT_PATH, @@ -1241,7 +1261,10 @@ pkgconf_pkg_scan_providers(pkgconf_client_t *client, pkgconf_dependency_t *pkgde pkg = pkgconf_scan_all(client, &ctx, (pkgconf_pkg_iteration_func_t) pkgconf_pkg_scan_provides_entry); if (pkg != NULL) + { + pkgdep->match = pkgconf_pkg_ref(client, pkg); return pkg; + } if (eflags != NULL) *eflags |= PKGCONF_PKG_ERRF_PACKAGE_NOT_FOUND; diff --git a/manifest b/manifest index 6d07d0a..cadf301 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ : 1 name: libpkgconf -version: 1.4.0+1 +version: 1.4.2-a.0.z summary: C library for retriving pkg-config compiler and linker flags license: ISC, MIT; ISC for the most of original files. tags: pkg-config, pkgconf, cflags, libs -- cgit v1.1