From 20391a21c0349c2a41432933e980d6a3007cfae5 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Sat, 29 Jul 2023 18:41:25 +0100 Subject: [PATCH] fix: freebsd build support (#1659) - Avoid hard-coding the path for bash - this typically is installed as /usr/local/bin/bash - Allow for the fact that FreeBSD's rlimit uses signed integers Almost all of the test suite passes with three test failures that I haven't tried to debug yet. Signed-off-by: Doug Rabson --- pkg/api/controller.go | 2 +- test/scripts/fuzzAll.sh | 4 ++-- test/scripts/gen_certs.sh | 4 +++- test/scripts/gen_nameless_certs.sh | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/api/controller.go b/pkg/api/controller.go index 56fbb08df..38728b3d0 100644 --- a/pkg/api/controller.go +++ b/pkg/api/controller.go @@ -75,7 +75,7 @@ func DumpRuntimeParams(log log.Logger) { err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit) if err == nil { - evt = evt.Uint64("max. open files", rLimit.Cur) + evt = evt.Uint64("max. open files", uint64(rLimit.Cur)) //nolint: unconvert // required for *BSD } if content, err := os.ReadFile("/proc/sys/net/core/somaxconn"); err == nil { diff --git a/test/scripts/fuzzAll.sh b/test/scripts/fuzzAll.sh index 5267665db..98af2f4ed 100644 --- a/test/scripts/fuzzAll.sh +++ b/test/scripts/fuzzAll.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e @@ -15,4 +15,4 @@ do parentDir=$(dirname $file) go test $parentDir -run=$func -fuzz=$func$ -fuzztime=${fuzzTime}s -tags sync,metrics,search,scrub,containers_image_openpgp | grep -oP -x '^(?:(?!\blevel\b).)*$' done -done \ No newline at end of file +done diff --git a/test/scripts/gen_certs.sh b/test/scripts/gen_certs.sh index 4d0f6ee9d..c52f6247f 100755 --- a/test/scripts/gen_certs.sh +++ b/test/scripts/gen_certs.sh @@ -1,4 +1,6 @@ -#!/bin/bash -xe +#!/usr/bin/env bash + +set -xe openssl req \ -newkey rsa:2048 \ diff --git a/test/scripts/gen_nameless_certs.sh b/test/scripts/gen_nameless_certs.sh index fd9767245..b4959ba4b 100755 --- a/test/scripts/gen_nameless_certs.sh +++ b/test/scripts/gen_nameless_certs.sh @@ -1,4 +1,6 @@ -#!/bin/bash -xe +#!/usr/bin/env bash + +set -xe openssl req \ -newkey rsa:2048 \