🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
1 messages
1 total messages Started by tony mancill Sun, 22 Nov 2026 02:20
Bug#1154753: pkgkde-symbolshelper: templinst detection misses instantiations with array types
#5429
Author: tony mancill
Date: Sun, 22 Nov 2026 02:20
175 lines
8650 bytes
--zEEsLanx/lS82byK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Package: pkg-kde-tools
Version: 0.22.1
Severity: normal
Tags: patch
Control: affects -1 src:bobcat

Dear Maintainer,

detect_cpp_templinst() in Debian::PkgKde::SymbolsHelper::Symbol does not
recognise template instantiations whose demangled name contains an array
type, so `pkgkde-symbolshelper create`, `patch` and `batchpatch` leave
them without the (optional=templinst) tag.

Example from libbobcat6 (src:bobcat):

  _ZN3FBBlsISt10unique_ptrIA_cSt14default_deleteIS2_EEEEONS_9ExceptionES7_RKT_
    FBB::Exception&& FBB::operator<< <std::unique_ptr<char [], std::default_delete<char []> > >(FBB::Exception&&, std::unique_ptr<char [], std::default_delete<char []> > const&)

The function removes whitespace around ',', '<', '>', '(' and ')' before
splitting the name on whitespace, but not around '[' and ']'.  The space
in "char []" survives, so the split breaks the function name inside the
template arguments, giving these tokens:

  1. FBB::Exception&&
  2. FBB::operator<<<std::unique_ptr<char
  3. [],std::default_delete<char
  4. []>>>(FBB::Exception&&,std::unique_ptr<char
  5. [],std::default_delete<char
  6. []>>const&)

Only the first two tokens are examined.  Neither contains "(", and the
check returns 0.

Adding '[' and ']' to the character classes removes the spaces around
the brackets as well, so the name splits only between the return type
and the function name:

  1. FBB::Exception&&
  2. FBB::operator<<<std::unique_ptr<char[],std::default_delete<char[]>>>(FBB::Exception&&,std::unique_ptr<char[],std::default_delete<char[]>>const&)

The second token contains "<...>" followed by "(", and the check
returns 1.

Proposed change:

--- a/perllib/Debian/PkgKde/SymbolsHelper/Symbol.pm
+++ b/perllib/Debian/PkgKde/SymbolsHelper/Symbol.pm
@@ -143,8 +143,8 @@
     my $cppname = $self->get_cppname();
     if (defined $cppname) {
 	# Prepare for tokenizing: wipe out unnecessary spaces
-	$cppname =~ s/([,<>()])\s+/$1/g;
-	$cppname =~ s/\s+([,<>()])/$1/g;
+	$cppname =~ s/([,<>()\[\]])\s+/$1/g;
+	$cppname =~ s/\s+([,<>()\[\]])/$1/g;
 	$cppname =~ s/\s*((?:(?:un)?signed|volatile|restrict|const|long)[*&]*)\s*/$1/g;
 	if (my @tokens = split(/\s+/, $cppname)) {
 	    my $func;

The attached patch contains this change and a test case,
t/symbolshelper/templinst_array_args to run batchpatch on new
symbols:

  _Z3fooIPcEvRKT_     void foo<char*>(char* const&)
  _Z3fooIA4_iEvRKT_   void foo<int [4]>(int const (&) [4])
  _Z3fooIA_iEvRKT_    void foo<int []>(int const (&) [])
  _Z3barRA4_i         bar(int (&) [4])

and expects the three foo instantiations to be tagged
(optional=templinst) and bar, which is not a template, to stay
untagged.

Thank you!
tony

--zEEsLanx/lS82byK
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="pkg-kde-tools-templinst-array.patch"

diff -Nru a/perllib/Debian/PkgKde/SymbolsHelper/Symbol.pm b/perllib/Debian/PkgKde/SymbolsHelper/Symbol.pm
--- a/perllib/Debian/PkgKde/SymbolsHelper/Symbol.pm	2026-07-19 11:21:10.000000000 -0700
+++ b/perllib/Debian/PkgKde/SymbolsHelper/Symbol.pm	2026-11-21 17:44:19.983781727 -0800
@@ -143,8 +143,8 @@
     my $cppname = $self->get_cppname();
     if (defined $cppname) {
 	# Prepare for tokenizing: wipe out unnecessary spaces
-	$cppname =~ s/([,<>()])\s+/$1/g;
-	$cppname =~ s/\s+([,<>()])/$1/g;
+	$cppname =~ s/([,<>()\[\]])\s+/$1/g;
+	$cppname =~ s/\s+([,<>()\[\]])/$1/g;
 	$cppname =~ s/\s*((?:(?:un)?signed|volatile|restrict|const|long)[*&]*)\s*/$1/g;
 	if (my @tokens = split(/\s+/, $cppname)) {
 	    my $func;
diff -Nru a/t/symbolshelper/CMakeLists.txt b/t/symbolshelper/CMakeLists.txt
--- a/t/symbolshelper/CMakeLists.txt	2026-07-19 11:21:10.000000000 -0700
+++ b/t/symbolshelper/CMakeLists.txt	2026-11-21 17:45:11.921739381 -0800
@@ -9,6 +9,7 @@
      missing_in_new_version
      missing_on_new_arch
      new_symbols
+     templinst_array_args
      DESTINATION .
 )
 add_test(NAME symbolshelper COMMAND run_tests.sh)
diff -Nru a/t/symbolshelper/run_tests.sh b/t/symbolshelper/run_tests.sh
--- a/t/symbolshelper/run_tests.sh	2026-07-19 11:21:10.000000000 -0700
+++ b/t/symbolshelper/run_tests.sh	2026-11-21 17:45:11.921032335 -0800
@@ -10,6 +10,7 @@
     missing_in_new_version
     missing_on_new_arch
     new_symbols
+    templinst_array_args
 '
 
 export PATH=$(pwd):$PATH
diff -Nru a/t/symbolshelper/templinst_array_args/amd64.diff b/t/symbolshelper/templinst_array_args/amd64.diff
--- a/t/symbolshelper/templinst_array_args/amd64.diff	1969-12-31 16:00:00.000000000 -0800
+++ b/t/symbolshelper/templinst_array_args/amd64.diff	2026-11-21 17:45:04.185737321 -0800
@@ -0,0 +1,9 @@
+--- debian/libfoo1.symbols (libfoo1_1.0_amd64)
++++ dpkg-gensymbols
+@@ -1,2 +1,6 @@
+ libfoo.so.1 libfoo1 #MINVER#
++ _Z3barRA4_i 1.0
+  _Z3bazi 0.1
++ _Z3fooIA4_iEvRKT_ 1.0
++ _Z3fooIA_iEvRKT_ 1.0
++ _Z3fooIPcEvRKT_ 1.0
diff -Nru a/t/symbolshelper/templinst_array_args/debian/control b/t/symbolshelper/templinst_array_args/debian/control
--- a/t/symbolshelper/templinst_array_args/debian/control	1969-12-31 16:00:00.000000000 -0800
+++ b/t/symbolshelper/templinst_array_args/debian/control	2026-11-21 17:45:04.185092816 -0800
@@ -0,0 +1,4 @@
+Source: foo
+
+Package: libfoo1
+Architecture: any
diff -Nru a/t/symbolshelper/templinst_array_args/debian/libfoo1.symbols.before b/t/symbolshelper/templinst_array_args/debian/libfoo1.symbols.before
--- a/t/symbolshelper/templinst_array_args/debian/libfoo1.symbols.before	1969-12-31 16:00:00.000000000 -0800
+++ b/t/symbolshelper/templinst_array_args/debian/libfoo1.symbols.before	2026-11-21 17:45:04.185212401 -0800
@@ -0,0 +1,3 @@
+# SymbolsHelper-Confirmed: 0.1 amd64 i386
+libfoo.so.1 libfoo1 #MINVER#
+ _Z3bazi 0.1
diff -Nru a/t/symbolshelper/templinst_array_args/debian/libfoo1.symbols.expected b/t/symbolshelper/templinst_array_args/debian/libfoo1.symbols.expected
--- a/t/symbolshelper/templinst_array_args/debian/libfoo1.symbols.expected	1969-12-31 16:00:00.000000000 -0800
+++ b/t/symbolshelper/templinst_array_args/debian/libfoo1.symbols.expected	2026-11-21 17:45:11.920375955 -0800
@@ -0,0 +1,7 @@
+# SymbolsHelper-Confirmed: 1.0 amd64 i386
+libfoo.so.1 libfoo1 #MINVER#
+ _Z3barRA4_i 1.0
+ _Z3bazi 0.1
+ (optional=templinst)_Z3fooIA4_iEvRKT_ 1.0
+ (optional=templinst)_Z3fooIA_iEvRKT_ 1.0
+ (optional=templinst)_Z3fooIPcEvRKT_ 1.0
diff -Nru a/t/symbolshelper/templinst_array_args/i386.diff b/t/symbolshelper/templinst_array_args/i386.diff
--- a/t/symbolshelper/templinst_array_args/i386.diff	1969-12-31 16:00:00.000000000 -0800
+++ b/t/symbolshelper/templinst_array_args/i386.diff	2026-11-21 17:45:04.186198908 -0800
@@ -0,0 +1,9 @@
+--- debian/libfoo1.symbols (libfoo1_1.0_i386)
++++ dpkg-gensymbols
+@@ -1,2 +1,6 @@
+ libfoo.so.1 libfoo1 #MINVER#
++ _Z3barRA4_i 1.0
+  _Z3bazi 0.1
++ _Z3fooIA4_iEvRKT_ 1.0
++ _Z3fooIA_iEvRKT_ 1.0
++ _Z3fooIPcEvRKT_ 1.0

--zEEsLanx/lS82byK--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads