commit:     4ce4f6c95f650134761659165756bad965d5aadb
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Sun Nov  9 18:28:39 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 12 09:40:35 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ce4f6c9

net-analyzer/termshark: fix tests with wireshark-4.6.0

Also add a small simplification/peformance fix.

Closes: https://bugs.gentoo.org/964258
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Part-of: https://github.com/gentoo/gentoo/pull/44556
Closes: https://github.com/gentoo/gentoo/pull/44556
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../termshark/files/2.4.0-column-titles.patch      | 50 ++++++++++++++++++++++
 .../termshark/files/2.4.0-use-sort.Strings.patch   | 18 ++++++++
 net-analyzer/termshark/termshark-2.4.0.ebuild      |  7 ++-
 3 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/net-analyzer/termshark/files/2.4.0-column-titles.patch 
b/net-analyzer/termshark/files/2.4.0-column-titles.patch
new file mode 100644
index 000000000000..cbd76a6926b1
--- /dev/null
+++ b/net-analyzer/termshark/files/2.4.0-column-titles.patch
@@ -0,0 +1,50 @@
+https://github.com/gcla/termshark/pull/170
+
+From: Gilbert Ramirez <[email protected]>
+Date: Sun, 19 Oct 2025 10:55:04 -0500
+Subject: [PATCH] Issue 169: With Wireshark 4.6.0, the column-title glossary 
changed
+
+A third column is now possible, so the column-format initializer
+needs to handle it. Also, since the output is a simple
+tab-separated-value format, we don't need regular expressions to
+parse it. We only need to split on tab characters.
+--- a/pkg/shark/columnformat.go
++++ b/pkg/shark/columnformat.go
+@@ -8,7 +8,6 @@ import (
+       "bufio"
+       "fmt"
+       "os/exec"
+-      "regexp"
+       "strconv"
+       "strings"
+       "sync"
+@@ -239,8 +238,6 @@ func (w *ColumnsFromTshark) InitFromCache() error {
+ }
+ 
+ func (w *ColumnsFromTshark) InitNoCache() error {
+-      re := regexp.MustCompile("\\s+")
+-
+       cmd := exec.Command(termshark.TSharkBin(), []string{"-G", 
"column-formats"}...)
+ 
+       out, err := cmd.StdoutPipe()
+@@ -254,11 +251,17 @@ func (w *ColumnsFromTshark) InitNoCache() error {
+ 
+       scanner := bufio.NewScanner(out)
+       for scanner.Scan() {
+-              fields := re.Split(scanner.Text(), 2)
+-              if len(fields) == 2 && strings.HasPrefix(fields[0], "%") {
++              fields := strings.Split(scanner.Text(), "\t")
++
++              // Column 0: The format
++              // Column 1: The title of the column
++              // Column 2: The display filter field (optional)
++              if (len(fields) == 2 || len(fields) == 3) && 
strings.HasPrefix(fields[0], "%") {
++                      // Remove trailing whitespace, if any
++                      columnTitle := strings.TrimRight(fields[1], " ")
+                       w.fields = append(w.fields, PsmlColumnSpec{
+                               Field: PsmlField{Token: fields[0]},
+-                              Name:  fields[1],
++                              Name:  columnTitle,
+                       })
+               }
+       }

diff --git a/net-analyzer/termshark/files/2.4.0-use-sort.Strings.patch 
b/net-analyzer/termshark/files/2.4.0-use-sort.Strings.patch
new file mode 100644
index 000000000000..a184c99032c0
--- /dev/null
+++ b/net-analyzer/termshark/files/2.4.0-use-sort.Strings.patch
@@ -0,0 +1,18 @@
+https://github.com/gcla/termshark/pull/155
+
+From: guoguangwu <[email protected]>
+Date: Wed, 5 Jul 2023 21:31:15 +0800
+Subject: [PATCH] chore: use sort.Strings(...) instead of 
sort.Sort(sort.StringSlice(...))
+
+Signed-off-by: guoguangwu <[email protected]>
+--- a/utils.go
++++ b/utils.go
+@@ -693,7 +693,7 @@ func KeyValueErrorString(err gowid.KeyValueError) string {
+       for k := range err.KeyVals {
+               ks = append(ks, k)
+       }
+-      sort.Sort(sort.StringSlice(ks))
++      sort.Strings(ks)
+       for _, k := range ks {
+               kvs = append(kvs, fmt.Sprintf("%v: %v", k, err.KeyVals[k]))
+       }

diff --git a/net-analyzer/termshark/termshark-2.4.0.ebuild 
b/net-analyzer/termshark/termshark-2.4.0.ebuild
index 8c20d52c4d9d..3389b06f4f49 100644
--- a/net-analyzer/termshark/termshark-2.4.0.ebuild
+++ b/net-analyzer/termshark/termshark-2.4.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -20,6 +20,11 @@ RDEPEND="
        net-analyzer/wireshark[dumpcap,pcap,tshark]
 "
 
+PATCHES=(
+       "${FILESDIR}/2.4.0-column-titles.patch"
+       "${FILESDIR}/2.4.0-use-sort.Strings.patch"
+)
+
 src_compile() {
        ego build ./...
 }

Reply via email to