Date: Sat, 04 Apr 2026 21:10:41 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 293516] freebsd-update without pkg(8) is largely unusable in FreeBSD 14.4-RELEASE Message-ID: <bug-293516-227-xjfnk5Pgow@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-293516-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293516 Wim Lewis <wiml@hhhh.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wiml@hhhh.org --- Comment #18 from Wim Lewis <wiml@hhhh.org> --- I think this is a bug in freebsd-update *and* another bug in the /usr/sbin/pkg(7) command. When 'freebsd-update' is hanging, it's running 'pkg -r / -N', which has prompted for user input but the prompt has been sent to /dev/null. If you press enter, freebsd-update will continue with the requested operation. I haven't tested the bug on FreeBSD-15.x, but I don't see a fix in Git, so it might occur there also. The freebsd-update bug is that it's passing '-r ${BASEDIR}' to pkg, but this is wrong in a number of ways: * pkg(7) doesn't have an -r flag to the left of the command. There's some discussion of this flag in the commit [1], the review D47341, and review D51770, but no one noticed that -r isn't a replacement for -c (the -c option doesn't exist in 14.4's /usr/sbin/pkg either). * some invocations of pkg(7) take an -r flag to the right of the command, but (a) the -r flag takes a reponame, not a base path, and does something totally different; and (b) the "-N" pseudo-command doesn't take a -r flag anyway. Presumably freebsd-update needs to implement its -b/-j functionality directly using some combination of $LOCALBASE/chroot(8)/jexec(8) in check_pkgbase(). (pkg(7) uses getlocalbase(3) so it'll respond to setting $LOCALBASE.) Alternately, since the only thing that "pkg -N" does is check whether localbase/sbin/pkg is there, I'm not sure that freebsd-update needs to invoke pkg(7) at all... it could just stat the file. You can see the pkg misbehavior(?) by running pkg directly: $ pkg -N pkg: pkg is not installed $ pkg -r / -N The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: I say "(?)" because the pkg(7) manpage doesn't say you can mix -N with any other options, but in my opinion pkg should fail if given a nonsensical set of options, rather than doing something unexpected. The underlying cause here is that the call to getopts_long() on line 1113 [2] stops when it sees the arg of the '-r' flag, so it never sees the -N flag. [1] https://cgit.freebsd.org/src/commit/usr.sbin/freebsd-update/freebsd-update.sh?h=stable/14&id=c9467d0b562c03a10ae358922eec6427bf250d03 [2] https://cgit.freebsd.org/src/tree/usr.sbin/pkg/pkg.c?h=releng/14.4&id=c9467d0b562c03a10ae358922eec6427bf250d03#n1113 -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-293516-227-xjfnk5Pgow>
