Page MenuHomeFreeBSD

bsdpv: revive dpv atop bsddialog
Needs ReviewPublic

Authored by dteske on Fri, Jul 10, 1:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jul 29, 12:29 PM
Unknown Object (File)
Mon, Jul 27, 8:56 AM
Unknown Object (File)
Sun, Jul 26, 1:47 AM
Unknown Object (File)
Sat, Jul 25, 9:49 PM
Unknown Object (File)
Fri, Jul 24, 5:46 AM
Unknown Object (File)
Sun, Jul 19, 3:18 AM
Unknown Object (File)
Fri, Jul 17, 7:40 AM
Unknown Object (File)
Fri, Jul 17, 7:34 AM

Details

Summary

Resurrect the dialog progress view -- disconnected from the build since
the LGPL dialog(3) removal -- as libbsdpv/bsdpv, rooted in bsddialog(3),
with the public API renamed dpv_* to bsdpv_* to mark a clean break from
the code that required GNU dialog.

libdpv depended on dlg_gauge_reallocate(), which bsddialog(3) does not
provide; rather than grow bsddialog, the port adopts the idiom bsddialog
itself uses in bsddialog_progressview() and bsddialog_mixedgauge():
recreate the gauge with bsddialog_gauge() on each update and let curses
compute the minimal screen delta. Terminal styling that previously reached
into dialog's color table now derives from bsddialog_get_theme() and
bsddialog_color_attrs(). The DPV_DISPLAY_DIALOG and DPV_DISPLAY_XDIALOG
spawn modes are removed: the former exec'd the GPL utility this change
exists to shed, and the latter served a long-dead X11 port. libfigpar
stays disconnected because its only consumer here was .dialogrc parsing
and bsddialog has no .dialogrc support; the one general-purpose routine
libdpv used from it, strexpandnl(), is absorbed as a private utility.
Both new components are PRIVATELIB, matching libbsddialog, so no
external ABI is promised.

The utility now defaults to a command-line progress view on standard
error; -D selects the bsddialog(3) gauge. A new CLI renderer in
libbsdpv paints per-file bars, an optional Overall row (-m), -a text,
and the status line with CSI updates, decoupled from the gauge refresh
rate (-U). Library callers that leave display_type zero still get
BSDPV_DISPLAY_BSDDIALOG for ABI stability. bsdpv_announce(3) exposes
transient Opening/Waiting status while blocked outside the main progress
loop (FIFO peers, -m paths); honor -U 0 by not remapping zero to the
default rate and by clearing leftover announce text when progress
resumes. Multi-path (-m) mode opens paths serially, treats '-' as
/dev/stdin, and uses non-blocking FIFO I/O so the UI stays responsive.

Three latent bugs inherited from dpv are fixed in the port: the
status-line formats given with -i/-I were unconditionally clobbered
after option parsing (and the many-files default was assigned the
solo-file format); the /dev/stdin descriptor heuristic was applied even
when stdin was a pipe, driving the input descriptor negative when -o or
-x was in use; and a transfer that ended between display updates could
exit without rendering its final Done/Fail state.

Add a pkgbase package for bsdpv. While here, fix creation of
$INCDIR/private/bsdpv/ by modifying share/mk/bsd.incs.mk.

Test Plan

Requires new bsddialog 1.2 here https://gitlab.com/alfix/bsddialog/-/merge_requests/12

Build/install, then ...

  1. yes | bsdpv -l - followed by Ctrl-c to abort when done
  2. yes | bsdpv -lN 1000000000:-
  3. yes | bsdpv -Dl - followed by Ctrl-c to abort when done
  4. yes | bsdpv -DlN 1000000000:-

First 2 are CLI interface, latter 2 are bsddialog interface.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75164
Build 72047: arc lint + arc unit

Event Timeline

dteske retitled this revision from commit 1214275b63fee367987c62bda49bf8519353d2ef Author: Devin Teske <dteske@FreeBSD.org> Date: Fri Jul 3 09:48:34 2026 -0700 to bsdpv: revive dpv atop bsddialog.Fri, Jul 10, 1:10 AM
dteske edited the summary of this revision. (Show Details)
dteske added reviewers: adrian, asiciliano, emaste, des.
dteske added reviewers: manpages, Installer.

Worth repeating:

Requires new bsddialog 1.2 here https://reviews.freebsd.org/D58118

bcr added a subscriber: bcr.

Nice man pages you have there. Shame if no-one would approve them. ;-)

This revision is now accepted and ready to land.Sat, Jul 11, 1:45 PM
usr.bin/bsdpv/Makefile
2

to add a new package, you also have to add the package definition in packages/bsdpv/ and update packages/Makefile.

please run make buildkernel buildworld update-packages to check the new package(s) are built correctly.

Add CLI interface, new default (require -D to enable bsddialog).
Add package files (thanks ivy)

This revision now requires review to proceed.Mon, Jul 27, 6:30 AM

What's the point of having it in base ?

What's the point of having it in base ?

Fair question. Short answer: base already had this job, and base still needs it.

dpv lived in base as the progress view for installer/config-style work. Upstream dialog grew dlg_reallocate_gauge for that path (2013/09/21); when FreeBSD moved off LGPL dialog(3) to bsddialog(3), that persistent-gauge lifecycle did not come along, so dpv was disconnected from the build rather than ported. This finishes that migration: same job, on bsddialog(3), with a CLI default for non-dialog contexts. The missing gauge open/update/flush/close path is proposed upstream in bsddialog MR !12 (FreeBSD discussion in D58118).

The immediate consumers are also in base: bsdconfig’s parallel package install progress (D58183) and bsdinstall/distextract progress (D58184), including the pkgbase install path. Those run before (or without) ports, so a ports-only helper does not cover installer/config/pkgbase.

Happy to expand on any of that if useful.

this breaks buildworld for me, i believe due to the changes in bsd.incs.mk:

===> lib/atf/libatf-c/tests/detail (includes)
--- _INCSINS ---
install -U  -C -o root -g wheel -m 444  /src/bsd/main/contrib/atf/atf-c/build.h /src/bsd/main/contrib/atf/atf-c/check.h /src/bsd/main/contrib/atf/atf-c/defs.h /src/bsd/main/contrib/atf/atf-c/error.h /src/bsd/main/contrib/atf/atf-c/error_fwd.h /src/bsd/main/contrib/atf/atf-c/macros.h /src/bsd/main/contrib/atf/atf-c/tc.h /src/bsd/main/contrib/atf/atf-c/tp.h /src/bsd/main/contrib/atf/atf-c/utils.h /build/obj/bsd/src/bsd/main/amd64.amd64/tmp/usr/include/atf-c/
make[5]: warning: Invalid character " " in variable name "INCSOWN_atf-c.h install-INCSdir"
        in command "${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${${:UINCS}OWN_${.ALLSRC:T}}  -g ${${:UINCS}GRP_${.ALLSRC:T}} -m ${${:UINCS}MODE_${.ALLSRC:T}}  ${.ALLSRC:Ninstall-${:UINCS}dir}  ${DESTDIR}${${:UINCS}DIR_${.ALLSRC:T}}/${${:UINCS}NAME_${.ALLSRC:T}}"
--- includes_subdir_lib/atf/libatf-c++ ---
--- includes_subdir_lib/atf/libatf-c++/tests ---
===> lib/atf/libatf-c++/tests (includes)
--- includes_subdir_lib/atf/libatf-c ---
        in target "_INCSINS_atf-c.h" from /src/bsd/main/share/mk/bsd.incs.mk:70
        in make[5] in directory "/src/bsd/main/lib/atf/libatf-c"
make[5]: warning: Invalid character " " in variable name "INCSGRP_atf-c.h install-INCSdir"
        in command "${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${${:UINCS}OWN_${.ALLSRC:T}}  -g ${${:UINCS}GRP_${.ALLSRC:T}} -m ${${:UINCS}MODE_${.ALLSRC:T}}  ${.ALLSRC:Ninstall-${:UINCS}dir}  ${DESTDIR}${${:UINCS}DIR_${.ALLSRC:T}}/${${:UINCS}NAME_${.ALLSRC:T}}"
        in target "_INCSINS_atf-c.h" from /src/bsd/main/share/mk/bsd.incs.mk:70
        in make[5] in directory "/src/bsd/main/lib/atf/libatf-c"
make[5]: warning: Invalid character " " in variable name "INCSMODE_atf-c.h install-INCSdir"
        in command "${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${${:UINCS}OWN_${.ALLSRC:T}}  -g ${${:UINCS}GRP_${.ALLSRC:T}} -m ${${:UINCS}MODE_${.ALLSRC:T}}  ${.ALLSRC:Ninstall-${:UINCS}dir}  ${DESTDIR}${${:UINCS}DIR_${.ALLSRC:T}}/${${:UINCS}NAME_${.ALLSRC:T}}"
        in target "_INCSINS_atf-c.h" from /src/bsd/main/share/mk/bsd.incs.mk:70
        in make[5] in directory "/src/bsd/main/lib/atf/libatf-c"
make[5]: warning: Invalid character " " in variable name "INCSDIR_atf-c.h install-INCSdir"
        in command "${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${${:UINCS}OWN_${.ALLSRC:T}}  -g ${${:UINCS}GRP_${.ALLSRC:T}} -m ${${:UINCS}MODE_${.ALLSRC:T}}  ${.ALLSRC:Ninstall-${:UINCS}dir}  ${DESTDIR}${${:UINCS}DIR_${.ALLSRC:T}}/${${:UINCS}NAME_${.ALLSRC:T}}"
        in target "_INCSINS_atf-c.h" from /src/bsd/main/share/mk/bsd.incs.mk:70
        in make[5] in directory "/src/bsd/main/lib/atf/libatf-c"
make[5]: warning: Invalid character " " in variable name "INCSNAME_atf-c.h install-INCSdir"
        in command "${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${${:UINCS}OWN_${.ALLSRC:T}}  -g ${${:UINCS}GRP_${.ALLSRC:T}} -m ${${:UINCS}MODE_${.ALLSRC:T}}  ${.ALLSRC:Ninstall-${:UINCS}dir}  ${DESTDIR}${${:UINCS}DIR_${.ALLSRC:T}}/${${:UINCS}NAME_${.ALLSRC:T}}"
        in target "_INCSINS_atf-c.h" from /src/bsd/main/share/mk/bsd.incs.mk:70
        in make[5] in directory "/src/bsd/main/lib/atf/libatf-c"

[...]

--- includes_subdir_lib/atf/libatf-c++ ---
--- install-INCSdir ---
install -U -d  -o root -g wheel -m 755  /build/obj/bsd/src/bsd/main/amd64.amd64/tmp/usr/include/atf-c++
--- includes_subdir_lib/atf/libatf-c ---
install: invalid file mode: /src/bsd/main/contrib/atf/atf-c.h
*** [_INCSINS_atf-c.h] Error code 64

make[5]: stopped making "includes" in /src/bsd/main/lib/atf/libatf-c
make[5]: 1 error
In D58133#1341701, @ivy wrote:

this breaks buildworld for me, i believe due to the changes in bsd.incs.mk:

Thanks for testing. I didn't get a chance to test properly as I was exhausted from a long day and just wanted to get it upstreamed before it got any bigger. That's on me.

The install-${group}dir dependency ends up in .ALLSRC, so the per-header INCSOWN_* / -m lookups see atf-c.h install-INCSdir and blow up. I will rework that part so the directory is created without polluting .ALLSRC.

Separate note for a full build of this stack: D58133 also needs the bsddialog 1.2 APIs from parent D58118 (upstream MR !12). Without that, libbsdpv fails on the new gauge symbols; it is unrelated to the bsd.incs.mk breakage you hit.

Fix bsd.incs.mk include-dir install (do not put install-${group}dir in .ALLSRC; thanks ivy)