[From nobody Mon Aug  3 16:57:07 2026
Received: (at submit) by bugs.debian.org; 23 Jul 2026 14:31:06 +0000
X-Spam-Checker-Version: SpamAssassin 4.0.1-bugs.debian.org_2005_01_02
 (2024-03-25) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-14.0 required=4.0 tests=BAYES_00,FROMDEVELOPER,
 FVGT_m_MULTI_ODD,NO_RELAYS,PGPSIGNATURE,WORD_WITHOUT_VOWELS,
 XMAILER_REPORTBUG autolearn=ham autolearn_force=no
 version=4.0.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 186; hammy, 150; neutral, 164; spammy,
 0. spammytokens: hammytokens:0.000-+--sk:iqizbae,
 0.000-+--sk:iQIzBAE, 
 0.000-+--H*Ad:N*Bug, 0.000-+--H*Ad:N*Tracking, 0.000-+--HTo:N*Debian
Return-path: &lt;nadzeya@debian.org&gt;
Received: via submission by buxtehude.debian.org with esmtp (Exim 4.96)
 (envelope-from &lt;nadzeya@debian.org&gt;) id 1wmuS0-00DK9s-1I
 for submit@bugs.debian.org; Thu, 23 Jul 2026 14:31:06 +0000
Content-Type: multipart/mixed; boundary=&quot;===============3095506468745962136==&quot;
MIME-Version: 1.0
From: Nadzeya Hutsko &lt;nadzeya@debian.org&gt;
To: Debian Bug Tracking System &lt;submit@bugs.debian.org&gt;
Subject: gdcm: will FTBFS with poppler &gt;= 26.02 (PDFDoc stream constructor,
 Object::getString() API changes)
Message-ID: &lt;178481706258.128070.9626854538039763766.reportbug@debian&gt;
X-Mailer: reportbug 13.2.0
Date: Thu, 23 Jul 2026 16:31:02 +0200
Delivered-To: submit@bugs.debian.org

This is a multi-part MIME message sent by reportbug.


--===============3095506468745962136==
Content-Type: text/plain; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Source: gdcm
Version: 3.0.24-11
Severity: normal
Tags: ftbfs patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Dear Maintainer,

gdcm fails to build against poppler &gt;= 26.02 (26.07.0 should be available
in experimental soon). Two poppler API changes break the build:

* poppler 26.02 changed the PDFDoc stream constructor to take
  std::unique_ptr&lt;BaseStream&gt;. This also breaks the
  LIBPOPPLER_PDFDOC_HAS_OPTIONAL configure probe (it tested the removed
  raw-pointer variant), so gdcminfo.cxx and gdcmpdf.cxx silently fall back
  to even older, long-removed poppler APIs
* poppler 26.04 changed Object::getString() to return const std::string&amp;
  instead of const GooString*

```
Applications/Cxx/gdcminfo.cxx:207:34: error: cannot convert 'const std::string' to 'const GooString*' in initialization
Applications/Cxx/gdcminfo.cxx:517:51: error: no matching function for call to 'PDFDoc::PDFDoc(MemStream*&amp;, GooString*&amp;, GooString*&amp;)'
```

The attached patch re-tests the optional-passwords probe via
PDFDocFactory, adds compile probes for the two new APIs, and adds code
branches for them. Everything follows the existing compile-probe
convention, so the patch is a no-op with the current poppler (26.01) and
is safe to apply now, ahead of the transition.

Thanks,
Nadzeya

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEuVOE/FJ0HcdfWSw//lAdKwFeZPsFAmpiJaAACgkQ/lAdKwFe
ZPuPTg//QPojsqkd71zylZOCHowAbVBQmsoQ32Dd+z7YU6ImhBmf294EEkNuhj2B
Wx0zRGIBS+UI6gZ17wO+CJjVSuPfhkXhamiaYRsU5BFTUHQwzF7AzUF24ZkubmGh
Ms9ctesVkLFjHa4lrSb3UlcY9MeqQLaUSBV2K3p/63WWlUGMOaQGW9EV19DZx3sE
CU2Mo/c2nD4HcScsJSvhgkVnwkPKLOO97Wpdl+H3kHrZKkOg8R5/HcelwgyQMHn9
KfuPfNqi4bRdvn3OOyt1IN+DfL2N6slY5FsF2IoaHTVCcnRKIBugBUoGZXTVQ6P/
RucB6qme+ftgalhbbTbLcwhMXmBW1o3mYqa9Ok6P2JVeYg5GILUQZpNOyqxfWJEw
5JoriUsxFvCkFvYYekcx3ixp2NLek/A5xkOLXW7cHUWaVao8I4V+LcqAd+FfZmso
c3T6gsyWZcvBIF781NoMEwvy+Y4n6sWYvFwSJG8N6Nas/gI5PKwf1rg7hMPSXDLS
OpdQ9DSBXnriCuMlPxqP8O5zD5NRaDgITRIsPIt+/XMaXdQGYs/vVuZv01zkxKoF
iTgtfhc+jIUWV3GUyy5FU3vTpzoJCp6rh98zJ2C9kyBEvLB/fhYwtICVBk0Hq+ji
ZdmgN0J1VUifoS+2EB6BEQ99w49z5S8CT2H7yYXRKZkwF7lXZA8=
=r62O
-----END PGP SIGNATURE-----

--===============3095506468745962136==
Content-Type: text/plain; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=&quot;fix-ftbfs-with-poppler-26.07.patch&quot;

Description: Fix FTBFS with poppler &gt;= 26.02
 Three poppler API changes break the build: 26.02 made the PDFDoc stream
 constructor take std::unique_ptr&lt;BaseStream&gt;, which also breaks the
 LIBPOPPLER_PDFDOC_HAS_OPTIONAL configure probe (it tested the removed raw
 pointer variant), and 26.04 changed Object::getString() to return
 const std::string&amp; instead of const GooString*
 .
 Re-test the optional-passwords probe via PDFDocFactory, add probes for the
 two new APIs, and add code branches for them. All checks are
 compile-probe-based, so older poppler still builds
Author: Nadzeya Hutsko &lt;nadzeya@ubuntu.com&gt;
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2161630
Forwarded: no
Last-Update: 2026-07-23
--- a/Applications/Cxx/CMakeLists.txt
+++ b/Applications/Cxx/CMakeLists.txt
@@ -117,12 +117,24 @@
     list(APPEND libpoppler_flags -DLIBPOPPLER_UNICODEMAP_HAS_CONSTMAPUNICODE)
   endif()
   CHECK_CXX_SOURCE_COMPILES(
-    &quot;\#include &lt;poppler/PDFDoc.h&gt;\nint main() { std::optional&lt;GooString&gt; ownerPW, userPW; PDFDoc d((BaseStream*)nullptr,ownerPW,userPW); return 0;}&quot;
+    &quot;\#include &lt;poppler/PDFDocFactory.h&gt;\nint main() { std::optional&lt;GooString&gt; ownerPW, userPW; GooString fileName; PDFDocFactory().createPDFDoc(fileName,ownerPW,userPW); return 0;}&quot;
     LIBPOPPLER_PDFDOC_HAS_OPTIONAL)
   if(LIBPOPPLER_PDFDOC_HAS_OPTIONAL)
     list(APPEND libpoppler_flags -DLIBPOPPLER_PDFDOC_HAS_OPTIONAL)
   endif()
   CHECK_CXX_SOURCE_COMPILES(
+    &quot;\#include &lt;poppler/PDFDoc.h&gt;\nint main() { std::optional&lt;GooString&gt; ownerPW, userPW; PDFDoc d(std::unique_ptr&lt;BaseStream&gt;{},ownerPW,userPW); return 0;}&quot;
+    LIBPOPPLER_PDFDOC_HAS_UNIQUEPTR_STREAM)
+  if(LIBPOPPLER_PDFDOC_HAS_UNIQUEPTR_STREAM)
+    list(APPEND libpoppler_flags -DLIBPOPPLER_PDFDOC_HAS_UNIQUEPTR_STREAM)
+  endif()
+  CHECK_CXX_SOURCE_COMPILES(
+    &quot;\#include &lt;poppler/Object.h&gt;\nint main() { Object o; const std::string &amp;s = o.getString(); (void)s; return 0; }&quot;
+    LIBPOPPLER_OBJECT_GETSTRING_IS_STDSTRING)
+  if(LIBPOPPLER_OBJECT_GETSTRING_IS_STDSTRING)
+    list(APPEND libpoppler_flags -DLIBPOPPLER_OBJECT_GETSTRING_IS_STDSTRING)
+  endif()
+  CHECK_CXX_SOURCE_COMPILES(
     &quot;\#include &lt;poppler/goo/GooString.h&gt;\nint main() { GooString gs; gs.size(); return 0; }&quot;
     LIBPOPPLER_GOOSTRING_HAS_SIZE)
   if(LIBPOPPLER_GOOSTRING_HAS_SIZE)
--- a/Applications/Cxx/gdcminfo.cxx
+++ b/Applications/Cxx/gdcminfo.cxx
@@ -201,6 +201,9 @@
   if (infoDict-&gt;lookup((char*)key, &amp;obj)-&gt;isString())
 #endif
     {
+#ifdef LIBPOPPLER_OBJECT_GETSTRING_IS_STDSTRING
+    s = obj.getString().c_str();
+#else
 #ifndef LIBPOPPLER_GOOSTRING_HAS_GETCSTRING
     const
 #endif
@@ -210,6 +213,7 @@
 #else
     s = gs-&gt;c_str();
 #endif
+#endif
     if (s[0] == 'D' &amp;&amp; s[1] == ':')
       {
       s += 2;
@@ -268,11 +272,13 @@
 #endif
 {
   Object obj;
+#ifndef LIBPOPPLER_OBJECT_GETSTRING_IS_STDSTRING
 #ifdef LIBPOPPLER_GOOSTRING_HAS_CONSTGETCHAR
   const GooString *s1;
 #else
   GooString *s1;
 #endif
+#endif
   bool isUnicode;
   Unicode u;
   char buf[8];
@@ -285,6 +291,37 @@
   if (infoDict-&gt;lookup((char*)key, &amp;obj)-&gt;isString())
 #endif
     {
+#ifdef LIBPOPPLER_OBJECT_GETSTRING_IS_STDSTRING
+    const std::string &amp;s1 = obj.getString();
+    if ((s1[0] &amp; 0xff) == 0xfe &amp;&amp;
+      (s1[1] &amp; 0xff) == 0xff)
+      {
+      isUnicode = true;
+      i = 2;
+      }
+    else
+      {
+      isUnicode = false;
+      i = 0;
+      }
+    while (i &lt; (int)s1.size())
+      {
+      if (isUnicode)
+        {
+        u = ((s1[i] &amp; 0xff) &lt;&lt; 8) |
+          (s1[i+1] &amp; 0xff);
+        i += 2;
+        }
+      else
+        {
+        u = pdfDocEncoding[s1[i] &amp; 0xff];
+        ++i;
+        }
+      n = uMap-&gt;mapUnicode(u, buf, sizeof(buf));
+      //fwrite(buf,1,n,stdout);
+      out.append( std::string(buf, n) );
+      }
+#else
     s1 = obj.getString();
     if ((s1-&gt;getChar(0) &amp; 0xff) == 0xfe &amp;&amp;
       (s1-&gt;getChar(1) &amp; 0xff) == 0xff)
@@ -318,6 +355,7 @@
       //fwrite(buf,1,n,stdout);
       out.append( std::string(buf, n) );
       }
+#endif
     }
 #ifndef LIBPOPPLER_NEW_OBJECT_API
   obj.free();
@@ -514,7 +552,11 @@
 #endif
 
     PDFDoc *doc;
+#ifdef LIBPOPPLER_PDFDOC_HAS_UNIQUEPTR_STREAM
+    doc = new PDFDoc(std::unique_ptr&lt;BaseStream&gt;(appearStream), ownerPW, userPW);
+#else
     doc = new PDFDoc(appearStream, ownerPW, userPW);
+#endif
 
     std::string title;
     std::string subject;
--- a/Applications/Cxx/gdcmpdf.cxx
+++ b/Applications/Cxx/gdcmpdf.cxx
@@ -52,6 +52,9 @@
   if (infoDict-&gt;lookup((char*)key, &amp;obj)-&gt;isString())
 #endif
     {
+#ifdef LIBPOPPLER_OBJECT_GETSTRING_IS_STDSTRING
+    s = obj.getString().c_str();
+#else
 #ifndef LIBPOPPLER_GOOSTRING_HAS_GETCSTRING
     const
 #endif
@@ -61,6 +64,7 @@
 #else
     s = gs-&gt;c_str();
 #endif
+#endif
     if (s[0] == 'D' &amp;&amp; s[1] == ':')
       {
       s += 2;
@@ -119,11 +123,13 @@
 #endif
 {
   Object obj;
+#ifndef LIBPOPPLER_OBJECT_GETSTRING_IS_STDSTRING
 #ifdef LIBPOPPLER_GOOSTRING_HAS_CONSTGETCHAR
   const GooString *s1;
 #else
   GooString *s1;
 #endif
+#endif
   bool isUnicode = false;
   Unicode u;
   char buf[8];
@@ -136,6 +142,37 @@
   if (infoDict-&gt;lookup((char*)key, &amp;obj)-&gt;isString())
 #endif
     {
+#ifdef LIBPOPPLER_OBJECT_GETSTRING_IS_STDSTRING
+    const std::string &amp;s1 = obj.getString();
+    if ((s1[0] &amp; 0xff) == 0xfe &amp;&amp;
+      (s1[1] &amp; 0xff) == 0xff)
+      {
+      isUnicode = true;
+      i = 2;
+      }
+    else
+      {
+      isUnicode = false;
+      i = 0;
+      }
+    while (i &lt; (int)s1.size())
+      {
+      if (isUnicode)
+        {
+        u = ((s1[i] &amp; 0xff) &lt;&lt; 8) |
+          (s1[i+1] &amp; 0xff);
+        i += 2;
+        }
+      else
+        {
+        u = pdfDocEncoding[s1[i] &amp; 0xff];
+        ++i;
+        }
+      n = uMap-&gt;mapUnicode(u, buf, sizeof(buf));
+      //fwrite(buf,1,n,stdout);
+      out.append( std::string(buf, n) );
+      }
+#else
     s1 = obj.getString();
     if ((s1-&gt;getChar(0) &amp; 0xff) == 0xfe &amp;&amp;
       (s1-&gt;getChar(1) &amp; 0xff) == 0xff)
@@ -169,6 +206,7 @@
       //fwrite(buf,1,n,stdout);
       out.append( std::string(buf, n) );
       }
+#endif
     }
 #ifndef LIBPOPPLER_NEW_OBJECT_API
   obj.free();

--===============3095506468745962136==--
]