From 979d36ec96fd2aa4720f983f2032a38b6c2b2dd4 Mon Sep 17 00:00:00 2001 From: naoNao89 <90588855+naoNao89@users.noreply.github.com> Date: Wed, 8 Oct 2025 22:59:49 +0700 Subject: [PATCH 1/3] fix: Use built coreutils install to avoid bootstrap failures When uutils-coreutils is installed as a system-wide replacement for GNU coreutils (e.g., on Gentoo with emerge), a bootstrap problem occurs: the Makefile uses the 'install' command, but if the system's install is from a broken or incomplete uutils installation, the build fails with errors like '-v: function/utility not found'. This fix moves the INSTALL variable definition to after BUILDDIR is set, allowing it to conditionally use the just-built coreutils install command. The logic checks for: 1. Multicall binary (BUILDDIR/coreutils) first 2. Standalone install binary (BUILDDIR/install) second 3. System install as fallback for first-time builds This prevents the chicken-and-egg problem where emerge can't build uutils because it depends on uutils being functional. Fixes #8837 --- GNUmakefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index 41ba59349e5..9a93145ed93 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,7 +6,6 @@ MULTICALL ?= n COMPLETIONS ?= y MANPAGES ?= y LOCALES ?= y -INSTALL ?= install ifneq (,$(filter install, $(MAKECMDGOALS))) override PROFILE:=release endif @@ -53,6 +52,21 @@ endif PKG_BUILDDIR := $(BUILDDIR)/deps DOCSDIR := $(BASEDIR)/docs +# Bootstrap protection: When uutils is installed as system coreutils (e.g., on +# Gentoo), the system 'install' may be broken or missing, causing build failures. +# Use the just-built 'install' binary to avoid this chicken-and-egg problem. +# Falls back to system 'install' for first-time builds. +ifneq ($(wildcard $(BUILDDIR)/coreutils),) + # Use multicall binary's install command if it exists + INSTALL ?= $(BUILDDIR)/coreutils install +else ifneq ($(wildcard $(BUILDDIR)/install),) + # Use standalone install binary if built without multicall + INSTALL ?= $(BUILDDIR)/install +else + # Fall back to system install command for first build + INSTALL ?= install +endif + BUSYBOX_ROOT := $(BASEDIR)/tmp BUSYBOX_VER := 1.36.1 BUSYBOX_SRC := $(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER) From 167069211660c54a1d9947b20f0720833cbce337 Mon Sep 17 00:00:00 2001 From: naoNao89 <90588855+naoNao89@users.noreply.github.com> Date: Thu, 9 Oct 2025 00:36:27 +0700 Subject: [PATCH 2/3] fix: Use cp instead of install in locales target to avoid bootstrap issue The locales target runs during the build phase before the install binary is built, causing 'install: function/utility not found' errors when INSTALL variable evaluates to a non-existent or broken system install command. Since the locales target only copies files to the build directory (not installing with special permissions), using cp is sufficient and avoids the Make variable evaluation timing issue where INSTALL is set at parse time before any binaries are built. This maintains the fix for #8837 while resolving the CI failure in the Build/Makefile job. --- GNUmakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 9a93145ed93..55544d3c806 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -463,7 +463,7 @@ locales: @if [ -d "$(BASEDIR)/src/uucore/locales" ]; then \ mkdir -p "$(BUILDDIR)/locales/uucore"; \ for locale_file in "$(BASEDIR)"/src/uucore/locales/*.ftl; do \ - $(INSTALL) -m 644 -v "$$locale_file" "$(BUILDDIR)/locales/uucore/"; \ + cp -v "$$locale_file" "$(BUILDDIR)/locales/uucore/"; \ done; \ fi; \ # Copy utility-specific locales @@ -472,7 +472,7 @@ locales: mkdir -p "$(BUILDDIR)/locales/$$prog"; \ for locale_file in "$(BASEDIR)"/src/uu/$$prog/locales/*.ftl; do \ if [ "$$(basename "$$locale_file")" != "en-US.ftl" ]; then \ - $(INSTALL) -m 644 -v "$$locale_file" "$(BUILDDIR)/locales/$$prog/"; \ + cp -v "$$locale_file" "$(BUILDDIR)/locales/$$prog/"; \ fi; \ done; \ fi; \ From 263dcf4f0b08579bff3ded05b8b976c33bc307f6 Mon Sep 17 00:00:00 2001 From: naoNao89 <90588855+naoNao89@users.noreply.github.com> Date: Thu, 9 Oct 2025 08:38:19 +0700 Subject: [PATCH 3/3] ci: Add verification test for bootstrap fix (issue #8837) Add a CI check to verify that locale files are successfully copied during the build phase without relying on the system install command. This test ensures the bootstrap issue doesn't regress. The test verifies: - Locales directory is created - Common uucore locales are copied - Utility-specific locales are copied - A reasonable number of locale files exist (>50) This addresses the maintainer request to add a regression test for the fix. --- .github/workflows/CICD.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index db756eac630..1df52eef5fe 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -293,6 +293,28 @@ jobs: test -f target/CACHEDIR.TAG # Restore cache for target/release (we only did a debug build) mv -t target/ target.cache/release 2>/dev/null || true + - name: "Verify bootstrap fix (issue #8837)" + shell: bash + run: | + set -x + # Verify that locales were successfully copied during build + # This ensures the bootstrap issue is fixed - the build should work + # even without relying on system 'install' command + + test -d target/debug/locales || { echo "::error ::Locales directory not created"; exit 1; } + + # Check for uucore common locales + test -f target/debug/locales/uucore/fr-FR.ftl || { echo "::error ::uucore locale not copied"; exit 1; } + + # Check for at least a few utility-specific locales + test -f target/debug/locales/ls/fr-FR.ftl || { echo "::error ::ls locale not copied"; exit 1; } + test -f target/debug/locales/cat/fr-FR.ftl || { echo "::error ::cat locale not copied"; exit 1; } + + # Count total locale files to ensure reasonable number were copied + LOCALE_COUNT=$(find target/debug/locales -name "*.ftl" | wc -l) + echo "Found $LOCALE_COUNT locale files" + [ "$LOCALE_COUNT" -gt 50 ] || { echo "::error ::Too few locale files copied ($LOCALE_COUNT)"; exit 1; } + - name: "`make nextest`" shell: bash run: make nextest CARGOFLAGS="--profile ci --hide-progress-bar"