Hello community, here is the log from the commit of package librepo for openSUSE:Factory checked in at 2020-07-15 11:22:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/librepo (Old) and /work/SRC/openSUSE:Factory/.librepo.new.3060 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "librepo" Wed Jul 15 11:22:14 2020 rev:12 rq:819220 version:1.12.0 Changes: -------- --- /work/SRC/openSUSE:Factory/librepo/librepo.changes 2020-01-19 20:58:31.740084649 +0100 +++ /work/SRC/openSUSE:Factory/.librepo.new.3060/librepo.changes 2020-07-15 11:23:54.245530307 +0200 @@ -1,0 +2,9 @@ +Tue Jul 7 10:38:49 UTC 2020 - Neal Gompa <ngomp...@gmail.com> + +- Upgrade to 1.12.0 + + Prefer mirrorlist/metalink over baseurl (rh#1775184) + + Decode package URL when using for local filename (rh#1817130) + + Fix memory leak in lr_download_metadata() and lr_yum_download_remote() + + Download sources work when at least one of specified is working (rh#1775184) + +------------------------------------------------------------------- Old: ---- librepo-1.11.2.tar.gz New: ---- librepo-1.12.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ librepo.spec ++++++ --- /var/tmp/diff_new_pack.J8NwYC/_old 2020-07-15 11:23:57.741533768 +0200 +++ /var/tmp/diff_new_pack.J8NwYC/_new 2020-07-15 11:23:57.745533772 +0200 @@ -37,7 +37,7 @@ %define devname %{name}-devel Name: librepo -Version: 1.11.2 +Version: 1.12.0 Release: 0 Summary: Repodata downloading library License: LGPL-2.0-or-later ++++++ librepo-1.11.2.tar.gz -> librepo-1.12.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/VERSION.cmake new/librepo-1.12.0/VERSION.cmake --- old/librepo-1.11.2/VERSION.cmake 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/VERSION.cmake 2020-05-15 09:43:49.000000000 +0200 @@ -1,3 +1,3 @@ SET(LIBREPO_MAJOR "1") -SET(LIBREPO_MINOR "11") -SET(LIBREPO_PATCH "2") +SET(LIBREPO_MINOR "12") +SET(LIBREPO_PATCH "0") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/librepo/checksum.c new/librepo-1.12.0/librepo/checksum.c --- old/librepo-1.11.2/librepo/checksum.c 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/librepo/checksum.c 2020-05-15 09:43:49.000000000 +0200 @@ -226,7 +226,11 @@ key = g_strdup_printf("user.Zif.MdChecksum[%llu]", (unsigned long long) st.st_mtime); +#if __APPLE__ + ssize_t attr_size = fgetxattr(fd, key, &buf, sizeof(buf), 0, 0); +#else ssize_t attr_size = fgetxattr(fd, key, &buf, sizeof(buf)); +#endif if (attr_size != -1) { // Cached checksum found g_debug("%s: Using checksum cached in xattr: [%s] %s", @@ -253,7 +257,11 @@ _cleanup_free_ gchar *key = NULL; key = g_strdup_printf("user.Zif.MdChecksum[%llu]", (unsigned long long) st.st_mtime); +#if __APPLE__ + fsetxattr(fd, key, checksum, strlen(checksum)+1, 0, 0); +#else fsetxattr(fd, key, checksum, strlen(checksum)+1, 0); +#endif } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/librepo/downloader.c new/librepo-1.12.0/librepo/downloader.c --- old/librepo-1.11.2/librepo/downloader.c 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/librepo/downloader.c 2020-05-15 09:43:49.000000000 +0200 @@ -977,7 +977,11 @@ else dst = g_strdup(fn); +#if __APPLE__ + int attr_ret = fsetxattr(fd, XATTR_LIBREPO, "1", 1, 0, 0); +#else int attr_ret = fsetxattr(fd, XATTR_LIBREPO, "1", 1, 0); +#endif if (attr_ret == -1) { g_debug("%s: Cannot set xattr %s (%s): %s", __func__, XATTR_LIBREPO, dst, g_strerror(errno)); @@ -990,7 +994,11 @@ static gboolean has_librepo_xattr(int fd) { +#if __APPLE__ + ssize_t attr_ret = fgetxattr(fd, XATTR_LIBREPO, NULL, 0, 0, 0); +#else ssize_t attr_ret = fgetxattr(fd, XATTR_LIBREPO, NULL, 0); +#endif if (attr_ret == -1) { //g_debug("%s: Cannot get xattr %s: %s", // __func__, XATTR_LIBREPO, g_strerror(errno)); @@ -1007,7 +1015,11 @@ { int fd = target->fd; if (fd != -1) { +#if __APPLE__ + fremovexattr(fd, XATTR_LIBREPO, 0); +#else fremovexattr(fd, XATTR_LIBREPO); +#endif return; } // If file descriptor wasn't set, file name was, and we need to open it @@ -1015,7 +1027,11 @@ if (fd == -1) { return; } +#if __APPLE__ + fremovexattr(fd, XATTR_LIBREPO, 0); +#else fremovexattr(fd, XATTR_LIBREPO); +#endif close(fd); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/librepo/downloadtarget.c new/librepo-1.12.0/librepo/downloadtarget.c --- old/librepo-1.11.2/librepo/downloadtarget.c 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/librepo/downloadtarget.c 2020-05-15 09:43:49.000000000 +0200 @@ -72,7 +72,7 @@ _cleanup_free_ gchar *final_baseurl = NULL; assert(path); - assert((fd > 0 && !fn) || (fd < 0 && fn)); + assert((fd >= 0 && !fn) || (fd < 0 && fn)); if (byterangestart && resume) { g_warning("Cannot specify byterangestart and set resume to TRUE at the same time"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/librepo/handle.c new/librepo-1.12.0/librepo/handle.c --- old/librepo-1.11.2/librepo/handle.c 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/librepo/handle.c 2020-05-15 09:43:49.000000000 +0200 @@ -1089,38 +1089,55 @@ local_path = url; } - gboolean ret; + // Since urls, mirrorlists and metalinks are not exclusive its + // sufficient for at least on of the three to succeed in order to + // continue. In the case where all of present ones fail we propagate + // only the last error, because GError cannot handle multiple + // errors at the same time. + + gboolean ret_urls = FALSE; + gboolean ret_mirrorlist = FALSE; + gboolean ret_metalink = FALSE; + gboolean at_least_one_present = FALSE; + GError *tmp_err = NULL; // LRO_URLS if (!handle->urls_mirrors && handle->urls) { - ret = lr_handle_prepare_urls(handle, err); - if (!ret) { - assert(!err || *err); - g_warning("LRO_URLS processing failed"); - return FALSE; + at_least_one_present = TRUE; + ret_urls = lr_handle_prepare_urls(handle, &tmp_err); + if (!ret_urls) { + assert(tmp_err); + g_warning("LRO_URLS processing failed: %s", tmp_err->message); } } // LRO_MIRRORLISTURL if (!handle->mirrorlist_mirrors && (handle->mirrorlisturl || local_path)) { - ret = lr_handle_prepare_mirrorlist(handle, local_path, err); - if (!ret) { - assert(!err || *err); - g_warning("LRO_MIRRORLISTURL processing failed"); - return FALSE; + g_clear_error(&tmp_err); + at_least_one_present = TRUE; + ret_mirrorlist = lr_handle_prepare_mirrorlist(handle, local_path, &tmp_err); + if (!ret_mirrorlist) { + assert(tmp_err); + g_warning("LRO_MIRRORLISTURL processing failed: %s", tmp_err->message); } } // LRO_METALINKURL if (!handle->metalink_mirrors && (handle->metalinkurl || local_path)) { - ret = lr_handle_prepare_metalink(handle, local_path, err); - if (!ret) { - assert(!err || *err); - g_warning("LRO_METALINKURL processing failed"); - return FALSE; + g_clear_error(&tmp_err); + at_least_one_present = TRUE; + ret_metalink = lr_handle_prepare_metalink(handle, local_path, &tmp_err); + if (!ret_metalink) { + assert(tmp_err); + g_warning("LRO_METALINKURL processing failed: %s", tmp_err->message); } } + if (!ret_urls && !ret_mirrorlist && !ret_metalink && at_least_one_present) { + g_propagate_error(err, tmp_err); + return FALSE; + } + // Append all the mirrorlist to the single internal mirrorlist // This internal mirrorlist is used for downloading // Note: LRO_MIRRORLISTURL and LRO_METALINKURL lists are included @@ -1129,11 +1146,6 @@ g_debug("%s: Finalizing internal mirrorlist", __func__); - // Mirrorlist from the LRO_URLS - handle->internal_mirrorlist = lr_lrmirrorlist_append_lrmirrorlist( - handle->internal_mirrorlist, - handle->urls_mirrors); - // Mirrorlist from the LRO_MIRRORLISTURL if (handle->mirrorlisturl) handle->internal_mirrorlist = lr_lrmirrorlist_append_lrmirrorlist( @@ -1146,6 +1158,11 @@ handle->internal_mirrorlist, handle->metalink_mirrors); + // Mirrorlist from the LRO_URLS + handle->internal_mirrorlist = lr_lrmirrorlist_append_lrmirrorlist( + handle->internal_mirrorlist, + handle->urls_mirrors); + // If enabled, sort internal mirrorlist by the connection // speed (the LRO_FASTESTMIRROR option) if (usefastestmirror) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/librepo/metadata_downloader.c new/librepo-1.12.0/librepo/metadata_downloader.c --- old/librepo-1.11.2/librepo/metadata_downloader.c 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/librepo/metadata_downloader.c 2020-05-15 09:43:49.000000000 +0200 @@ -326,7 +326,7 @@ int fd_value = *((int *) fd->data); if (!target->handle || fd_value == -1) { - continue; + goto fail; } handle = target->handle; @@ -335,28 +335,35 @@ if (target->download_target->rcode != LRE_OK) { lr_metadatatarget_append_error(target, (char *) lr_strerror(target->download_target->rcode), NULL); - continue; + goto fail; } if (!lr_check_repomd_xml_asc_availability(handle, target->repo, fd_value, path->data, &error)) { lr_metadatatarget_append_error(target, error->message, NULL); g_error_free(error); - continue; + goto fail; } lseek(fd_value, SEEK_SET, 0); ret = lr_yum_repomd_parse_file(target->repomd, fd_value, lr_xml_parser_warning_logger, "Repomd xml parser", &error); - close(fd_value); if (!ret) { lr_metadatatarget_append_error(target, "Parsing unsuccessful: %s", error->message, NULL); - lr_free(path->data); g_error_free(error); - continue; + goto fail; } + close(fd_value); + lr_free(fd->data); target->repo->destdir = g_strdup(handle->destdir); target->repo->repomd = path->data; + continue; + fail: + if (fd_value != -1) { + close(fd_value); + } + lr_free(path->data); + lr_free(fd->data); } } @@ -421,6 +428,10 @@ } process_repomd_xml(targets, fd_list, paths); + + g_slist_free(fd_list); + g_slist_free(paths); + lr_yum_download_repos(targets, err); return cleanup(download_targets, err); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/librepo/package_downloader.c new/librepo-1.12.0/librepo/package_downloader.c --- old/librepo-1.11.2/librepo/package_downloader.c 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/librepo/package_downloader.c 2020-05-15 09:43:49.000000000 +0200 @@ -255,8 +255,10 @@ if (packagetarget->dest) { if (g_file_test(packagetarget->dest, G_FILE_TEST_IS_DIR)) { // Dir specified - _cleanup_free_ gchar *file_basename; - file_basename = g_path_get_basename(packagetarget->relative_url); + // unencode first in case there are any encoded slashes to + // prevent any path changing shenanigans + _cleanup_free_ gchar * unencoded_url = g_uri_unescape_string(packagetarget->relative_url, ""); + _cleanup_free_ gchar * file_basename = g_path_get_basename(unencoded_url); local_path = g_build_filename(packagetarget->dest, file_basename, @@ -266,7 +268,10 @@ } } else { // No destination path specified - local_path = g_path_get_basename(packagetarget->relative_url); + // unencode first in case there are any encoded slashes to + // prevent any path changing shenanigans + _cleanup_free_ gchar * unencoded_url = g_uri_unescape_string(packagetarget->relative_url, ""); + local_path = g_path_get_basename(unencoded_url); } packagetarget->local_path = g_string_chunk_insert(packagetarget->chunk, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/librepo/package_downloader.h new/librepo-1.12.0/librepo/package_downloader.h --- old/librepo-1.11.2/librepo/package_downloader.h 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/librepo/package_downloader.h 2020-05-15 09:43:49.000000000 +0200 @@ -138,7 +138,8 @@ * @param relative_url Relative part of URL to download. * First part of URL will be picked from the LrHandle * (LRO_URL or mirror) during download process or - * base_url will be used if it is specified. + * base_url will be used if it is specified. It is + * expected to already come URL-encoded. * @param dest Destination filename or just directory (filename * itself will be derived from the relative_url) or * NULL (current working directory + filename derived diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/librepo/yum.c new/librepo-1.12.0/librepo/yum.c --- old/librepo-1.11.2/librepo/yum.c 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/librepo/yum.c 2020-05-15 09:43:49.000000000 +0200 @@ -457,8 +457,6 @@ g_debug("%s: Cannot open: %s", __func__, signature); g_set_error(err, LR_YUM_ERROR, LRE_IO, "Cannot open %s: %s", signature, g_strerror(errno)); - close(fd); - lr_free(path); lr_free(signature); return FALSE; } @@ -490,8 +488,6 @@ __func__, tmp_err->message); g_propagate_prefixed_error(err, tmp_err, "repomd.xml GPG signature verification error: "); - close(fd); - lr_free(path); return FALSE; } g_debug("%s: GPG signature successfully verified", __func__); @@ -1309,8 +1305,11 @@ return FALSE; } - if (!lr_check_repomd_xml_asc_availability(handle, repo, fd, path, err)) + if (!lr_check_repomd_xml_asc_availability(handle, repo, fd, path, err)) { + close(fd); + lr_free(path); return FALSE; + } lseek(fd, 0, SEEK_SET); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/librepo.spec new/librepo-1.12.0/librepo.spec --- old/librepo-1.11.2/librepo.spec 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/librepo.spec 2020-05-15 09:43:49.000000000 +0200 @@ -26,7 +26,7 @@ %global dnf_conflict 2.8.8 Name: librepo -Version: 1.11.2 +Version: 1.12.0 Release: 1%{?dist} Summary: Repodata downloading library @@ -82,7 +82,8 @@ BuildRequires: python2-pyxattr BuildRequires: python2-gpg %endif -%endif # with pythontests +%endif +# endif with pythontests Requires: %{name}%{?_isa} = %{version}-%{release} Conflicts: python2-dnf < %{dnf_conflict} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librepo-1.11.2/tests/test_checksum.c new/librepo-1.12.0/tests/test_checksum.c --- old/librepo-1.11.2/tests/test_checksum.c 2020-01-19 15:50:24.000000000 +0100 +++ new/librepo-1.12.0/tests/test_checksum.c 2020-05-15 09:43:49.000000000 +0200 @@ -113,7 +113,11 @@ fail_if(ret != 0); key = g_strdup_printf("user.Zif.MdChecksum[%llu]", (unsigned long long) st.st_mtime); +#if __APPLE__ + attr_ret = getxattr(filename, key, &buf, sizeof(buf), 0, 0); +#else attr_ret = getxattr(filename, key, &buf, sizeof(buf)); +#endif lr_free(key); fail_if(attr_ret != -1); // Cached checksum should not exists @@ -136,7 +140,11 @@ fail_if(ret != 0); key = g_strdup_printf("user.Zif.MdChecksum[%llu]", (unsigned long long) st.st_mtime); +#if __APPLE__ + attr_ret = getxattr(filename, key, &buf, sizeof(buf), 0, 0); +#else attr_ret = getxattr(filename, key, &buf, sizeof(buf)); +#endif lr_free(key);