Commit db159f0f authored by Sören Tempel's avatar Sören Tempel
Browse files

testing/termshark: fix build on riscv64

* Requires newer version of the pty module.
* Use dup3 instead of dup2.

See https://github.com/gcla/termshark/issues/127
parent 86134b42
......@@ -10,11 +10,21 @@ arch="all !armhf" # no tshark on armhf
depends="tshark"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/gcla/termshark/archive/v$pkgver.tar.gz
use-github-org-unix-termios.patch"
use-github-org-unix-termios.patch
no-dup2.patch"
export GOPATH="$srcdir"
export GOFLAGS="$GOFLAGS -trimpath -mod=readonly -modcacherw"
prepare() {
default_prepare
# fix build on riscv64
go mod edit -replace \
github.com/kr/pty=github.com/creack/pty@v1.1.13
go mod tidy
}
build() {
go build -v ./cmd/...
}
......@@ -32,5 +42,8 @@ package() {
rm -rf "$GOPATH"/pkg/mod
}
sha512sums="5ab2e2ccb7d4ab71a5b364c9677a24725dc5702a1c574f93ec2f4f09aba2322c292728f9ea02eb1d7378e7ea32ee4952dc59fd7b699e70fcaa3007c1f28219db termshark-2.2.0.tar.gz
a2007fe37003765b3cf844e67d7bc263ba49335705844d199d32f526d5dd6ea28a279779204e25962adf1ff94370c324384c258d5ce97e64bbfa0d20913b67b1 use-github-org-unix-termios.patch"
sha512sums="
5ab2e2ccb7d4ab71a5b364c9677a24725dc5702a1c574f93ec2f4f09aba2322c292728f9ea02eb1d7378e7ea32ee4952dc59fd7b699e70fcaa3007c1f28219db termshark-2.2.0.tar.gz
a2007fe37003765b3cf844e67d7bc263ba49335705844d199d32f526d5dd6ea28a279779204e25962adf1ff94370c324384c258d5ce97e64bbfa0d20913b67b1 use-github-org-unix-termios.patch
0af3ecf933c6f40ece1e90954d6b2828aa6d37634a027d7fb2097132fd714fbce676201d254d68aa88bc3a2560ffb0e2d57ba0012e5b8b2848a67626682c24fc no-dup2.patch
"
The dup2 syscalls is not available on riscv64. However, using dup3 with
zero as a flags argument is equivalent.
diff -upr termshark-2.2.0.orig/system/dumpcapext.go termshark-2.2.0/system/dumpcapext.go
--- termshark-2.2.0.orig/system/dumpcapext.go 2021-07-10 16:53:56.607649135 +0200
+++ termshark-2.2.0/system/dumpcapext.go 2021-07-10 16:55:47.034414600 +0200
@@ -47,7 +47,7 @@ func DumpcapExt(dumpcapBin string, tshar
if err != nil {
log.Warnf("Unexpected error parsing %s: %v", args[1], err)
} else {
- err = syscall.Dup2(fd, 0)
+ err = syscall.Dup3(fd, 0, 0)
if err != nil {
log.Warnf("Problem duplicating fd %d to 0: %v", fd, err)
log.Warnf("Will not try to replace argument %s to tshark", args[1])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment