mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2025-12-08 00:05:33 +03:00
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@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@gentoo.org>
This commit is contained in:
parent
611ae0b91a
commit
4ce4f6c95f
50
net-analyzer/termshark/files/2.4.0-column-titles.patch
Normal file
50
net-analyzer/termshark/files/2.4.0-column-titles.patch
Normal file
@ -0,0 +1,50 @@
|
||||
https://github.com/gcla/termshark/pull/170
|
||||
|
||||
From: Gilbert Ramirez <gram@alumni.rice.edu>
|
||||
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,
|
||||
})
|
||||
}
|
||||
}
|
||||
18
net-analyzer/termshark/files/2.4.0-use-sort.Strings.patch
Normal file
18
net-analyzer/termshark/files/2.4.0-use-sort.Strings.patch
Normal file
@ -0,0 +1,18 @@
|
||||
https://github.com/gcla/termshark/pull/155
|
||||
|
||||
From: guoguangwu <guoguangwu@magic-shield.com>
|
||||
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 <guoguangwu@magic-shield.com>
|
||||
--- 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]))
|
||||
}
|
||||
@ -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 ./...
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user