diff --git a/ports-mgmt/pkg/Makefile b/ports-mgmt/pkg/Makefile index b5954452538d..6853583905d4 100644 --- a/ports-mgmt/pkg/Makefile +++ b/ports-mgmt/pkg/Makefile @@ -1,62 +1,63 @@ PORTNAME= pkg DISTVERSION= 2.3.1 +PORTREVISION= 1 _PKG_VERSION= ${DISTVERSION} CATEGORIES= ports-mgmt MAINTAINER= pkg@FreeBSD.org COMMENT= Package manager WWW= https://github.com/freebsd/pkg LICENSE= BSD2CLAUSE USE_GITHUB= yes GH_ACCOUNT= freebsd USE_LDCONFIG= ${PREFIX}/lib/compat/pkg HAS_CONFIGURE= yes PORTDOCS= NEWS PORTSCOUT= ignore:1 CONFIGURE_ARGS= --prefix="${PREFIX}" CONFIGURE_ENV= CC_FOR_BUILD="${CC}" # Use a submake as 'deinstall install' needs to reevaluate PKG_REGISTER # so that pkg-static is used from the wrkdir USE_SUBMAKE= yes CFLAGS+= -Wno-error OPTIONS_DEFINE= DOCS .if !exists(/usr/include/jail.h) EXTRA_PATCHES= ${FILESDIR}/extra-patch-docs_pkg.8 .endif .include .if defined(WITH_DEBUG) MAKE_ARGS+= DEBUG_FLAGS="${DEBUG_FLAGS}" .endif .if defined(WITH_PKG) .if ${WITH_PKG} == devel IGNORE= WITH_PKG is defined to 'devel', this version is the stable one .endif .endif #define PKG_DEPENDS to nothing to avoid infinite loop looking for pkg :) PKG_DEPENDS= .undef INSTALLS_DEPENDS # Use the internal pkg instead, generally, unless this is a cross-build, # in which case that won't work. Hope for the best then. .if !defined(CROSS_TOOLCHAIN) PKG_BIN= ${WRKSRC}/src/pkg-static .endif post-install: @${MKDIR} ${STAGEDIR}${PREFIX}/lib/compat/pkg post-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/NEWS ${STAGEDIR}${DOCSDIR}/NEWS .include diff --git a/ports-mgmt/pkg/files/patch-7ea9566835a82f111d7771f58168babc5e0dde6a.patch b/ports-mgmt/pkg/files/patch-7ea9566835a82f111d7771f58168babc5e0dde6a.patch new file mode 100644 index 000000000000..608f5e232fa1 --- /dev/null +++ b/ports-mgmt/pkg/files/patch-7ea9566835a82f111d7771f58168babc5e0dde6a.patch @@ -0,0 +1,33 @@ +From 7ea9566835a82f111d7771f58168babc5e0dde6a Mon Sep 17 00:00:00 2001 +From: Mark Johnston +Date: Thu, 23 Oct 2025 21:54:36 +0000 +Subject: [PATCH] libpkg: Use line buffering for the metalog file handle + +Otherwise we can get interleaved metalog entries when a package +install script appends entries to the metalog as well. + +Reported by: cperciva +--- + libpkg/metalog.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libpkg/metalog.c b/libpkg/metalog.c +index 9ffac87ae7..07b7419b66 100644 +--- libpkg/metalog.c ++++ libpkg/metalog.c +@@ -37,11 +37,11 @@ int + metalog_open(const char *metalog) + { + metalogfp = fopen(metalog, "ae"); +- if (metalogfp == NULL) { ++ if (metalogfp == NULL) + pkg_fatal_errno("Unable to open metalog '%s'", metalog); +- } +- +- return EPKG_OK; ++ /* Package install scripts may add entries, so avoid interleaving. */ ++ setvbuf(metalogfp, NULL, _IOLBF, 0); ++ return (EPKG_OK); + } + + int