fix for script detection on NetBSD 9

0 views
Skip to first unread message

Greg Troxel

unread,
Dec 8, 2025, 6:32:17 PM (5 days ago) Dec 8
to bup-...@googlegroups.com
Also at g...@github.com:gdt/bup.git fix/script-netbsd-9

The basic issue is that the test for the second script invocation has
the arguments backward, for at least NetBSD before 10, and the test
inovation hangs.

I am really not sure about script on FreeBSD, and it may be that there
is no safe way to test and we have to case on `uname`.

With this (and not the previous), tests run on NetBSD 9, and pass except
for 3 instances of "with-tty script seems to return before it is done".

Proposed for main and 0.33.x, but needs looking at on FreeBSD and
OtherBSDs.


(And I meant to include Signed-Off-By, which I don't think about -- this
is my work, no AI and obviously intended to be conveyed under bup's
license.)




From 6a64803870a668e683bd3094449f6fd6bc99f049 Mon Sep 17 00:00:00 2001
From: Greg Troxel <g...@lexort.com>
Date: Wed, 26 Nov 2025 14:30:56 -0500
Subject: [PATCH] dev: Fix with-tty for NetBSD 9

Also fixes for some other older BSDs.
---
dev/with-tty | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dev/with-tty b/dev/with-tty
index c65aa1d4..6d104c20 100755
--- a/dev/with-tty
+++ b/dev/with-tty
@@ -8,11 +8,11 @@ usage() { echo 'Usage: with-tty command [arg ...]'; }
misuse() { usage 1>&2; exit 2; }

if script -qec true /dev/null; then
- # linux flavor
+ # Linux flavor (also NetBSD 10+)
script -qec "$(printf ' %q' "$@")" /dev/null
-elif script -q /dev/null true; then
- # bsd flavor
- script -q /dev/null "$@"
+elif script -q -c true /dev/null; then
+ # Relatively modern BSD flavor
+ script -q -c "$@" /dev/null
else
rc=0
cmd="$(command -v script)" || rc=$?
--
2.51.0

Reply all
Reply to author
Forward
0 new messages