hanging test - probably a portability issue

2 views
Skip to first unread message

Greg Troxel

unread,
Oct 12, 2025, 6:24:58 PM (10 days ago) Oct 12
to bup-...@googlegroups.com
With today's 0.33 branch:

+ echo '! /home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls:306 bup save -n src --strip src ok'
! /home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls:306 bup save -n src --strip src ok
+ '[' 0 -ne 0 ']'
+ return 0
+ return 0
+ WVPASS with-tty /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest
+ local 'TEXT=with-tty /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest'
+ _wvpushcall with-tty /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest
+ _wvbtstack[${#_wvbtstack[@]}]='with-tty /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest'
+ _wvfind_caller
+ WVPASS wc -l
+ WVCALLER_FILE=/home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls
+ WVCALLER_LINE=307
+ with-tty /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest
+ /home/gdt/SOFTWARE/BUP/bup/dev/with-tty /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest
+ local 'TEXT=wc -l'
+ _wvpushcall wc -l
+ _wvbtstack[${#_wvbtstack[@]}]='wc -l'
+ _wvfind_caller
+ WVCALLER_FILE=/home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls
+ WVCALLER_LINE=307
+ wc -l

and when wedged, ps shows

gdt 2561 0.0 0.0 23988 2316 pts/4 I+ 6:16PM 0:00.00 bash -x /home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls
gdt 2675 0.0 0.0 17720 1240 pts/4 I+ 6:16PM 0:00.04 script -qec /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest /dev/null
gdt 13075 0.0 0.0 17652 1396 pts/4 I+ 6:16PM 0:00.00 script -qec /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest /dev/null
gdt 15019 0.0 0.0 18488 1920 pts/4 I+ 6:16PM 0:00.03 wc -l
gdt 20171 0.0 0.0 23988 2336 pts/4 I+ 6:16PM 0:00.00 bash -x /home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls
gdt 21929 0.0 0.0 23776 3232 pts/4 I+ 6:16PM 0:00.00 bash /home/gdt/SOFTWARE/BUP/bup/dev/with-tty /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest


On NetBSD 10, "script -qec true /dev/null" exits with 0.

I am unclear on if the quoting here is right, or what the intent is:

script -qec "$(printf ' %q' "$@")" /dev/null

I'll try main, too.

Rob Browning

unread,
Oct 14, 2025, 12:42:09 PM (9 days ago) Oct 14
to Greg Troxel, bup-...@googlegroups.com
Greg Troxel <g...@lexort.com> writes:

> and when wedged, ps shows
>
> gdt 2561 0.0 0.0 23988 2316 pts/4 I+ 6:16PM 0:00.00 bash -x /home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls
> gdt 2675 0.0 0.0 17720 1240 pts/4 I+ 6:16PM 0:00.04 script -qec /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest /dev/null
> gdt 13075 0.0 0.0 17652 1396 pts/4 I+ 6:16PM 0:00.00 script -qec /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest /dev/null
> gdt 15019 0.0 0.0 18488 1920 pts/4 I+ 6:16PM 0:00.03 wc -l
> gdt 20171 0.0 0.0 23988 2336 pts/4 I+ 6:16PM 0:00.00 bash -x /home/gdt/SOFTWARE/BUP/bup/test/ext/test-ls
> gdt 21929 0.0 0.0 23776 3232 pts/4 I+ 6:16PM 0:00.00 bash /home/gdt/SOFTWARE/BUP/bup/dev/with-tty /home/gdt/SOFTWARE/BUP/bup/bup ls -l src/latest

Does "script -qec bup ls -l SOMETHING/latest /dev/null" work if you run
it directly for some repository/branch?

> On NetBSD 10, "script -qec true /dev/null" exits with 0.

Right, seems like it should from the manpage:

https://man.netbsd.org/script.1

(looks like linux and netbsd have compatible options there).

> I am unclear on if the quoting here is right, or what the intent is:
>
> script -qec "$(printf ' %q' "$@")" /dev/null

That's just intending to make sure we properly escape the requested
command before passing it through -c (e.g. for arguments with spaces
etc.).

Bash's printf %q handles the quoting, and printf automatically repeats
the formatting to consume all of its arguments. So it turns

printf ' %q' 'a b' 'c d'

into

a\ b c\ d

> I'll try main, too.

I had also started augmenting with-tty a bit back. So far, here, I have:

#!/usr/bin/env bash

set -ueo pipefail

# Callers can test for support via "with-tty true".

usage() { echo 'Usage: with-tty command [arg ...]'; }
misuse() { usage 1>&2; exit 2; }

if script -qec true /dev/null; then
script -qec "$(printf ' %q' "$@")" /dev/null
elif script -q /dev/null true; then
script -q /dev/null "$@"
else
rc=0
cmd="$(command -v script)" || rc=$?
if test "$rc" -eq 0; then
printf 'Unsupported script command: %q\n' "$cmd" 1>&2
else
echo 'No script command' 1>&2
fi
exit 2
fi

But I don't think that'll affect whatever problem you're encountering.

--
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4

Greg Troxel

unread,
Oct 17, 2025, 11:47:00 AM (6 days ago) Oct 17
to Rob Browning, bup-...@googlegroups.com
I have been distracted but have achieved some understanding and wanted
to send an update.

I think that I am having hangs on NetBSD 9 because the script argument
order and general invocation convention is different. I'm now not sure
what's going on with NetBSD 10 (because I'm confused with too many
things at once).

I'll see if I can isolate the multiple issues, or if indeed there are
two vs just one and confusion.


Reply all
Reply to author
Forward
0 new messages