Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Aug 2021 03:14:45 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 54247ce1f96f - main - Makefile.inc1: Avoid hanging if pkg is not installed
Message-ID:  <202108080314.1783EjMt090159@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=54247ce1f96f04d16f1429007bac3607c8a0a39e

commit 54247ce1f96f04d16f1429007bac3607c8a0a39e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-08-08 01:50:32 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-08-08 03:13:40 +0000

    Makefile.inc1: Avoid hanging if pkg is not installed
    
    For `pkg --version`, Redirect stdin from /dev/null to avoid waiting on
    /usr/sbin/pkg's bootstrap prompt if the pkg package is not installed.
    Also redirect stderr to /dev/null to discard the warning message in
    this case.
    
    Reported by:    mjg
    Fixes:          4e224e4be7c3 ("pkgbase: accommodate pkg < 1.17")
    Sponsored by:   The FreeBSD Foundation
---
 Makefile.inc1 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index be8ac02353e1..2c1f72085110 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1889,7 +1889,8 @@ _pkgbootstrap: .PHONY
 .if make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages) || make(sign-packages)
 PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI
 .endif
-PKG_BIN_VERSION!=${PKG_CMD} --version | awk -F. '/^[0-9.]+$$/ {print $$1 * 10000 + $$2 * 100 + $$3}'
+PKG_BIN_VERSION!=${PKG_CMD} --version </dev/null 2>/dev/null |\
+    awk -F. '/^[0-9.]+$$/ {print $$1 * 10000 + $$2 * 100 + $$3}'
 .if ${PKG_BIN_VERSION} < 11700
 PKG_EXT=	${PKG_FORMAT}
 .else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108080314.1783EjMt090159>