[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#992613: buster-pu: package icu/63.1-6+deb10u2



Package: release.debian.org
User: release.debian.org@packages.debian.org
Tags: buster
Severity: normal

Hi RMs,

ICU had a non-standard tool for revealing its headers and libs paths,
compiler switches needed for development. This tool, icu-config, was
removed after being deprecated over pkg-config for years. Then another
ICU tool, pkgdata remained to use that [1]. It seems some projects
still didn't switch to pkg-config but use the mentioned ICU one.
There's an upstream fix for this, included in newer ICU releases -
meaning it's proven in Bullseye and Sid as well.
The only packaging change following this, pkg-data became a dependency
for icu-devtools due to its usage in pkgdata.

[ Reason ]
ICU tool pkgdata still would like to get headers and library data via
its removed icu-config. Upstream fixed it for newer ICU releases to
use pkg-config instead.

[ Impact ]
Code that compiles with ICU and uses pkgdata to reveal its headers and
libraries will work again.

[ Tests ]
Local tests and problem reporter confirmed the fix. It's also part of
Bullseye and Sid versions of ICU, working correctly.

[ Risks ]
None.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in buster
  [x] the issue is verified as fixed in unstable

Thanks for considering,
Laszlo/GCS
[1] https://bugs.debian.org/992591
diff -Nru icu-63.1/debian/changelog icu-63.1/debian/changelog
--- icu-63.1/debian/changelog	2020-03-13 19:49:33.000000000 +0100
+++ icu-63.1/debian/changelog	2021-08-21 07:28:38.000000000 +0200
@@ -1,3 +1,13 @@
+icu (63.1-6+deb10u2) buster; urgency=medium
+
+  * Add pkg-config dependency to icu-devtools.
+
+  [ Scott Talbert <swt@techie.net> ]
+  * Backport upstream fix for pkgdata to work without icu-config
+    (closes: #992591).
+
+ -- Laszlo Boszormenyi (GCS) <gcs@debian.org>  Sat, 21 Aug 2021 07:28:38 +0200
+
 icu (63.1-6+deb10u1) buster-security; urgency=high
 
   * Backport upstream security fix for CVE-2020-10531: SEGV_MAPERR in
diff -Nru icu-63.1/debian/control icu-63.1/debian/control
--- icu-63.1/debian/control	2019-01-23 17:51:20.000000000 +0100
+++ icu-63.1/debian/control	2021-08-21 07:28:38.000000000 +0200
@@ -51,7 +51,7 @@
 Architecture: any
 Multi-Arch: foreign
 Pre-Depends: ${misc:Pre-Depends}
-Depends: ${misc:Depends}, ${shlibs:Depends}
+Depends: ${misc:Depends}, ${shlibs:Depends}, pkg-config
 Replaces: libicu-dev (<< ${binary:Version}), icu-tools (<< 63.1-1~)
 Breaks: libicu-dev (<< ${binary:Version}), icu-tools (<< 63.1-1~)
 Description: Development utilities for International Components for Unicode
diff -Nru icu-63.1/debian/patches/ICU-20924-Use-pkg-config-to-generate-the-path-to-pkg.patch icu-63.1/debian/patches/ICU-20924-Use-pkg-config-to-generate-the-path-to-pkg.patch
--- icu-63.1/debian/patches/ICU-20924-Use-pkg-config-to-generate-the-path-to-pkg.patch	1970-01-01 01:00:00.000000000 +0100
+++ icu-63.1/debian/patches/ICU-20924-Use-pkg-config-to-generate-the-path-to-pkg.patch	2021-08-20 23:53:11.000000000 +0200
@@ -0,0 +1,139 @@
+From 5aae52d3ef316b3fd3c43b3f974a8032d279e6fc Mon Sep 17 00:00:00 2001
+From: Hugh McMaster <hugh.mcmaster@outlook.com>
+Date: Mon, 23 Dec 2019 22:11:05 +1100
+Subject: [PATCH] ICU-20924 Use pkg-config to generate the path to pkgdata.inc
+
+---
+ icu4c/source/tools/pkgdata/pkgdata.cpp | 84 +++++++++++++-------------
+ 1 file changed, 43 insertions(+), 41 deletions(-)
+
+diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp
+index 7235a7f669..6406fcc7a5 100644
+--- a/source/tools/pkgdata/pkgdata.cpp
++++ b/source/tools/pkgdata/pkgdata.cpp
+@@ -95,7 +95,7 @@ static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UB
+ static void createFileNames(UPKGOptions *o, const char mode, const char *version_major, const char *version, const char *libName, const UBool reverseExt, UBool noVersion);
+ static int32_t initializePkgDataFlags(UPKGOptions *o);
+ 
+-static int32_t pkg_getOptionsFromICUConfig(UBool verbose, UOption *option);
++static int32_t pkg_getPkgDataPath(UBool verbose, UOption *option);
+ static int runCommand(const char* command, UBool specialHandling=FALSE);
+ 
+ #define IN_COMMON_MODE(mode) (mode == 'a' || mode == 'c')
+@@ -309,7 +309,7 @@ main(int argc, char* argv[]) {
+ 
+ #if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN)
+         if(!options[BLDOPT].doesOccur && uprv_strcmp(options[MODE].value, "common") != 0) {
+-          if (pkg_getOptionsFromICUConfig(options[VERBOSE].doesOccur, &options[BLDOPT]) != 0) {
++          if (pkg_getPkgDataPath(options[VERBOSE].doesOccur, &options[BLDOPT]) != 0) {
+                 fprintf(stderr, " required parameter is missing: -O is required for static and shared builds.\n");
+                 fprintf(stderr, "Run '%s --help' for help.\n", progname);
+                 return 1;
+@@ -2158,41 +2158,46 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
+     } /* for each file list file */
+ }
+ 
+-/* Try calling icu-config directly to get the option file. */
+- static int32_t pkg_getOptionsFromICUConfig(UBool verbose, UOption *option) {
++/* Helper for pkg_getPkgDataPath() */
+ #if U_HAVE_POPEN
+-    LocalPipeFilePointer p;
+-    size_t n;
+-    static char buf[512] = "";
++static UBool getPkgDataPath(const char *cmd, UBool verbose, char *buf, size_t items) {
+     icu::CharString cmdBuf;
+     UErrorCode status = U_ZERO_ERROR;
+-    const char cmd[] = "icu-config --incpkgdatafile";
+-    char dirBuf[1024] = "";
+-    /* #1 try the same path where pkgdata was called from. */
+-    findDirname(progname, dirBuf, UPRV_LENGTHOF(dirBuf), &status);
+-    if(U_SUCCESS(status)) {
+-      cmdBuf.append(dirBuf, status);
+-      if (cmdBuf[0] != 0) {
+-        cmdBuf.append( U_FILE_SEP_STRING, status );
+-      }
+-      cmdBuf.append( cmd, status );
+-      
+-      if(verbose) {
+-        fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf.data());
+-      }
+-      p.adoptInstead(popen(cmdBuf.data(), "r"));
+-    }
+-
+-    if(p.isNull() || (n = fread(buf, 1, UPRV_LENGTHOF(buf)-1, p.getAlias())) <= 0) {
+-        if(verbose) {
+-            fprintf(stdout, "# Calling icu-config: %s\n", cmd);
+-        }
++    LocalPipeFilePointer p;
++    size_t n;
+ 
+-        p.adoptInstead(popen(cmd, "r"));
+-        if(p.isNull() || (n = fread(buf, 1, UPRV_LENGTHOF(buf)-1, p.getAlias())) <= 0) {
+-            fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname);
++    cmdBuf.append(cmd, status);
++    if (verbose) {
++        fprintf(stdout, "# Calling: %s\n", cmdBuf.data());
++    }
++    p.adoptInstead( popen(cmdBuf.data(), "r") );
++
++    if (p.isNull() || (n = fread(buf, 1, items-1, p.getAlias())) <= 0) {
++        fprintf(stderr, "%s: Error calling '%s'\n", progname, cmd);
++        *buf = 0;
++        return FALSE;
++    }
++
++    return TRUE;
++}
++#endif
++
++/* Get path to pkgdata.inc. Try pkg-config first, falling back to icu-config. */
++static int32_t pkg_getPkgDataPath(UBool verbose, UOption *option) {
++#if U_HAVE_POPEN
++    static char buf[512] = "";
++    UBool pkgconfigIsValid = TRUE;
++    const char *pkgconfigCmd = "pkg-config --variable=pkglibdir icu-uc";
++    const char *icuconfigCmd = "icu-config --incpkgdatafile";
++    const char *pkgdata = "pkgdata.inc";
++
++    if (!getPkgDataPath(pkgconfigCmd, verbose, buf, UPRV_LENGTHOF(buf))) {
++        if (!getPkgDataPath(icuconfigCmd, verbose, buf, UPRV_LENGTHOF(buf))) {
++            fprintf(stderr, "%s: icu-config not found. Fix PATH or specify -O option\n", progname);
+             return -1;
+         }
++
++        pkgconfigIsValid = FALSE;
+     }
+ 
+     for (int32_t length = strlen(buf) - 1; length >= 0; length--) {
+@@ -2203,21 +2208,18 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
+         }
+     }
+ 
+-    if(buf[strlen(buf)-1]=='\n')
+-    {
+-        buf[strlen(buf)-1]=0;
+-    }
+-
+-    if(buf[0] == 0)
+-    {
+-        fprintf(stderr, "%s: icu-config: invalid response from icu-config (fix PATH or use -O option)\n", progname);
++    if (!*buf) {
++        fprintf(stderr, "%s: Unable to locate pkgdata.inc. Unable to parse the results of '%s'. Check paths or use the -O option to specify the path to pkgdata.inc.\n", progname, pkgconfigIsValid ? pkgconfigCmd : icuconfigCmd);
+         return -1;
+     }
+ 
+-    if(verbose) {
+-      fprintf(stdout, "# icu-config said: %s\n", buf);
++    if (pkgconfigIsValid) {
++        uprv_strcat(buf, U_FILE_SEP_STRING);
++        uprv_strcat(buf, pkgdata);
+     }
+ 
++    buf[strlen(buf)] = 0;
++
+     option->value = buf;
+     option->doesOccur = TRUE;
+ 
+-- 
+2.25.1
+
diff -Nru icu-63.1/debian/patches/series icu-63.1/debian/patches/series
--- icu-63.1/debian/patches/series	2020-03-13 19:49:31.000000000 +0100
+++ icu-63.1/debian/patches/series	2021-08-20 23:53:11.000000000 +0200
@@ -6,3 +6,4 @@
 ICU-20246_Fixing_another_integer_overflow_in_number_parsing.patch
 ICU-20208_uspoof.cpp_function_checkImpl_should_be_static.patch
 CVE-2020-10531.patch
+ICU-20924-Use-pkg-config-to-generate-the-path-to-pkg.patch

Reply to: