[R-pkg-team] Bug#1028124: r-cran-hunspell: old copy of internal hunspell headers breaks (autopkg)test with hunspell 1.7.2

Rene Engelhard rene at debian.org
Sat Jan 7 14:13:22 GMT 2023


Package: r-cran-hunspell
Version: 3.0.2+dfsg-1
Severity: important

Dear Maintainer,

see
https://ci.debian.net/data/autopkgtest/unstable/amd64/r/r-cran-hunspell/29859278/log.gz

I firstly thought there might be some hidden ABI breakage in hunspell,
but it seems not to be the case. Actually it seems  that you add some
internal hunspell headers (I *believe* they are nit installed per
purpose) in debian/rules:

override_dh_auto_build:
	# FIXME: For the moment hack missing header files in here
	# Once we are sure that package build file bug report against
	# libhunspell-dev to include those missing header files
	cp -a debian/hunspell src
	dh_auto_build

Those seem to be updated in hunspell 1.7.2 making some more stuff
private:

--- csutil.hxx	2022-09-12 10:37:44.000000000 +0000
+++ csutil.hxx	2023-01-07 13:34:41.000000000 +0000
@@ -1,7 +1,7 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
- * Copyright (C) 2002-2017 Németh László
+ * Copyright (C) 2002-2022 Németh László
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
@@ -78,7 +78,9 @@
 #include <fstream>
 #include <string>
 #include <vector>
-#include <string.h>
+#include <cassert>
+#include <cstring>
+#include <algorithm>
 #include "w_char.hxx"
 #include "htypes.hxx"

@@ -135,14 +137,12 @@

 // convert UTF-8 characters to UTF-16
 LIBHUNSPELL_DLL_EXPORTED int u8_u16(std::vector<w_char>& dest,
-                                    const std::string& src);
+                                    const std::string& src,
+                                    bool only_convert_first_letter = false);

 // remove end of line char(s)
 LIBHUNSPELL_DLL_EXPORTED void mychomp(std::string& s);

-// duplicate string
-LIBHUNSPELL_DLL_EXPORTED char* mystrdup(const char* s);
-
 // parse into tokens with char delimiter
 LIBHUNSPELL_DLL_EXPORTED std::string::const_iterator mystrsep(const std::string &str,
                                                               std::string::const_iterator& start);
@@ -181,8 +181,6 @@
   unsigned char cupper;
 };

-LIBHUNSPELL_DLL_EXPORTED void initialize_utf_tbl();
-LIBHUNSPELL_DLL_EXPORTED void free_utf_tbl();
 LIBHUNSPELL_DLL_EXPORTED unsigned short unicodetoupper(unsigned short c,
                                                        int langnum);
 LIBHUNSPELL_DLL_EXPORTED w_char upper_utf(w_char u, int langnum);
@@ -276,10 +274,8 @@
 // "likely false", if ignored_chars characters are not ASCII)
 inline bool has_no_ignored_chars(const std::string& word,
                             const std::string& ignored_chars) {
-  for (std::string::const_iterator it = ignored_chars.begin(), end = ignored_chars.end(); it != end; ++it)
-    if (word.find(*it) != std::string::npos)
-      return false;
-  return true;
+  return std::all_of(ignored_chars.begin(), ignored_chars.end(),
+    [&word](char ic) { return word.find(ic) == std::string::npos; });
 }

 // hash entry macros
@@ -319,9 +315,9 @@
   return ret;
 }

-inline char* HENTRY_FIND(struct hentry* h,
-                                                  const char* p) {
-  return (HENTRY_DATA(h) ? strstr(HENTRY_DATA(h), p) : NULL);
+inline char* HENTRY_FIND(struct hentry* h, const char* p) {
+  char* data = HENTRY_DATA(h);
+  return data ? strstr(data, p) : NULL;
 }

 #endif
diff -Nru r-cran-hunspell-3.0.2+dfsg/debian/hunspell/htypes.hxx r-cran-hunspell-3.0.2+dfsg/debian/hunspell/htypes.hxx
--- htypes.hxx	2022-09-12 10:37:44.000000000 +0000
+++ htypes.hxx	2023-01-07 13:34:34.000000000 +0000
@@ -1,7 +1,7 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
- * Copyright (C) 2002-2017 Németh László
+ * Copyright (C) 2002-2022 Németh László
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with

Indeed I see

src/parsers/textparser.cc:    u8_u16(wc, w);

Updating those headers from hunspell 1.7.2 makes it work. The build and
(build-time) test passes.

I have attached a full debdiff (also with . I can NMU if you wish (debdiff +
adding bug number of this and the clean issue) and upload hunspell 1.7.2 to sid in
the same go or you upload and I'll follow with an hunspell upload after it.

Regards,

Rene
-------------- next part --------------
diff -Nru r-cran-hunspell-3.0.2+dfsg/debian/changelog r-cran-hunspell-3.0.2+dfsg/debian/changelog
--- r-cran-hunspell-3.0.2+dfsg/debian/changelog	2022-09-12 12:37:44.000000000 +0200
+++ r-cran-hunspell-3.0.2+dfsg/debian/changelog	2023-01-07 14:35:07.000000000 +0100
@@ -1,3 +1,12 @@
+r-cran-hunspell (3.0.2+dfsg-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * update copy of (private) htypes.hxx and csutil.hxx to fix build
+    with hunspell 1.7.2. Bump build-dependency 
+  * add override_dh_auto_clean to clean up generated files
+
+ -- Rene Engelhard <rene at debian.org>  Sat, 07 Jan 2023 14:35:07 +0100
+
 r-cran-hunspell (3.0.2+dfsg-1) unstable; urgency=medium
 
   * New upstream version
diff -Nru r-cran-hunspell-3.0.2+dfsg/debian/control r-cran-hunspell-3.0.2+dfsg/debian/control
--- r-cran-hunspell-3.0.2+dfsg/debian/control	2022-09-12 12:37:44.000000000 +0200
+++ r-cran-hunspell-3.0.2+dfsg/debian/control	2023-01-07 14:35:04.000000000 +0100
@@ -14,7 +14,7 @@
                r-base-dev,
                r-cran-rcpp,
                r-cran-digest,
-               libhunspell-dev
+               libhunspell-dev (>= 1.7.2+really1.7.2)
 Testsuite: autopkgtest-pkg-r
 
 Package: r-cran-hunspell
diff -Nru r-cran-hunspell-3.0.2+dfsg/debian/hunspell/csutil.hxx r-cran-hunspell-3.0.2+dfsg/debian/hunspell/csutil.hxx
--- r-cran-hunspell-3.0.2+dfsg/debian/hunspell/csutil.hxx	2022-09-12 12:37:44.000000000 +0200
+++ r-cran-hunspell-3.0.2+dfsg/debian/hunspell/csutil.hxx	2023-01-07 14:34:41.000000000 +0100
@@ -1,7 +1,7 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
- * Copyright (C) 2002-2017 Németh László
+ * Copyright (C) 2002-2022 Németh László
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
@@ -78,7 +78,9 @@
 #include <fstream>
 #include <string>
 #include <vector>
-#include <string.h>
+#include <cassert>
+#include <cstring>
+#include <algorithm>
 #include "w_char.hxx"
 #include "htypes.hxx"
 
@@ -135,14 +137,12 @@
 
 // convert UTF-8 characters to UTF-16
 LIBHUNSPELL_DLL_EXPORTED int u8_u16(std::vector<w_char>& dest,
-                                    const std::string& src);
+                                    const std::string& src,
+                                    bool only_convert_first_letter = false);
 
 // remove end of line char(s)
 LIBHUNSPELL_DLL_EXPORTED void mychomp(std::string& s);
 
-// duplicate string
-LIBHUNSPELL_DLL_EXPORTED char* mystrdup(const char* s);
-
 // parse into tokens with char delimiter
 LIBHUNSPELL_DLL_EXPORTED std::string::const_iterator mystrsep(const std::string &str,
                                                               std::string::const_iterator& start);
@@ -181,8 +181,6 @@
   unsigned char cupper;
 };
 
-LIBHUNSPELL_DLL_EXPORTED void initialize_utf_tbl();
-LIBHUNSPELL_DLL_EXPORTED void free_utf_tbl();
 LIBHUNSPELL_DLL_EXPORTED unsigned short unicodetoupper(unsigned short c,
                                                        int langnum);
 LIBHUNSPELL_DLL_EXPORTED w_char upper_utf(w_char u, int langnum);
@@ -276,10 +274,8 @@
 // "likely false", if ignored_chars characters are not ASCII)
 inline bool has_no_ignored_chars(const std::string& word,
                             const std::string& ignored_chars) {
-  for (std::string::const_iterator it = ignored_chars.begin(), end = ignored_chars.end(); it != end; ++it)
-    if (word.find(*it) != std::string::npos)
-      return false;
-  return true;
+  return std::all_of(ignored_chars.begin(), ignored_chars.end(), 
+    [&word](char ic) { return word.find(ic) == std::string::npos; });
 }
 
 // hash entry macros
@@ -319,9 +315,9 @@
   return ret;
 }
 
-inline char* HENTRY_FIND(struct hentry* h,
-                                                  const char* p) {
-  return (HENTRY_DATA(h) ? strstr(HENTRY_DATA(h), p) : NULL);
+inline char* HENTRY_FIND(struct hentry* h, const char* p) {
+  char* data = HENTRY_DATA(h);
+  return data ? strstr(data, p) : NULL;
 }
 
 #endif
diff -Nru r-cran-hunspell-3.0.2+dfsg/debian/hunspell/htypes.hxx r-cran-hunspell-3.0.2+dfsg/debian/hunspell/htypes.hxx
--- r-cran-hunspell-3.0.2+dfsg/debian/hunspell/htypes.hxx	2022-09-12 12:37:44.000000000 +0200
+++ r-cran-hunspell-3.0.2+dfsg/debian/hunspell/htypes.hxx	2023-01-07 14:34:34.000000000 +0100
@@ -1,7 +1,7 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
- * Copyright (C) 2002-2017 Németh László
+ * Copyright (C) 2002-2022 Németh László
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
diff -Nru r-cran-hunspell-3.0.2+dfsg/debian/rules r-cran-hunspell-3.0.2+dfsg/debian/rules
--- r-cran-hunspell-3.0.2+dfsg/debian/rules	2022-09-12 12:37:44.000000000 +0200
+++ r-cran-hunspell-3.0.2+dfsg/debian/rules	2023-01-07 14:35:07.000000000 +0100
@@ -3,6 +3,10 @@
 %:
 	dh $@ --buildsystem R
 
+override_dh_auto_clean:
+	dh_auto_clean
+	rm -f src/hunspell/*
+
 override_dh_auto_build:
 	# FIXME: For the moment hack missing header files in here
 	# Once we are sure that package build file bug report against


More information about the R-pkg-team mailing list