+
Skip to content

Conversation

naoNao89
Copy link
Contributor

@naoNao89 naoNao89 commented Oct 8, 2025

Fix bootstrap failure when uutils replaces system coreutils

Fixes #8837

Use the just-built install binary instead of system install to avoid bootstrap failures on systems where uutils has replaced GNU coreutils.

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 uutils#8837
@oech3
Copy link
Contributor

oech3 commented Oct 8, 2025

I think this should be considered as bug of each package manager.

Copy link

github-actions bot commented Oct 8, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

@naoNao89 naoNao89 marked this pull request as draft October 8, 2025 16:27
@sylvestre
Copy link
Contributor

could you please add a check in github action that verify that this issue doesn't happen anymore? thanks

…ssue

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 uutils#8837 while resolving the CI failure in the
Build/Makefile job.
@oech3
Copy link
Contributor

oech3 commented Oct 8, 2025

This is Gentoo-side issue: #8837 (comment)
This project cannot do anything.

Copy link

github-actions bot commented Oct 8, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@naoNao89 naoNao89 force-pushed the fix/install-bootstrap-8837 branch from 0d07dae to 0bb9e7c Compare October 9, 2025 01:07
@naoNao89
Copy link
Contributor Author

naoNao89 commented Oct 9, 2025

separate Gentoo issue (not fixed here)

as @Alxhr0 discovered, Gentoo's emerge has issues with symlinked multicall binaries:

"when ls,install,cat etc are symlinks, Emerge passes the flags directly to the coreutils binary"

Copy link

github-actions bot commented Oct 9, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

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.
@naoNao89 naoNao89 force-pushed the fix/install-bootstrap-8837 branch from 0bb9e7c to 263dcf4 Compare October 9, 2025 01:38
Copy link

github-actions bot commented Oct 9, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@naoNao89 naoNao89 marked this pull request as ready for review October 9, 2025 02:04
@oech3
Copy link
Contributor

oech3 commented Oct 10, 2025

I think this PR should be closed and broken system should be fixed by different method.
make is installer and build tools of uutils/coreutils, not a recovery tool...

@naoNao89 naoNao89 marked this pull request as draft October 10, 2025 18:48
@naoNao89
Copy link
Contributor Author

this fixes a real bootstrap problem where rebuilding uutils fails because the system install command is broken. The solution is clean - move INSTALL definition after BUILDDIR so it can use the just-built binary when available.

  • Self-healing build process, backward compatible, well tested with CI verification.
  • cons: Makes the makefile handle system recovery which some argue should be the package manager's job. Also creates inconsistency using cp for build tasks but INSTALL for install tasks.

I think this should be merged as a pragmatic fix. The conditional logic is straightforward and the CI test proves it works.

for future work: document MULTICALL=n as recommended for system replacement, consider using cp consistently for all build-time file copying, and report the emerge symlink issue upstream to Gentoo.

@naoNao89 naoNao89 marked this pull request as ready for review October 10, 2025 19:10
@naoNao89
Copy link
Contributor Author

@oech3 not "recovery tool" - It's "smart build system"
Looking at the project history, conditional variable overrides have been core to this Makefile since commit 02a0401 (2015). The pattern of inspecting MAKECMDGOALS and adapting behavior (PROFILE, BUILD, etc.) is well-established.

coreutils/GNUmakefile

Lines 10 to 12 in 97093b4

ifneq (,$(filter install, $(MAKECMDGOALS)))
override PROFILE:=release
endif

This PR extends that same philosophy to the INSTALL command—using the just-built binary when available is consistent with the project's 10-year design of intelligent, context-aware builds. The pattern already used for goal detection and OS detection.

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/usage_vs_getopt (passes in this run but fails in the 'main' branch)

@oech3
Copy link
Contributor

oech3 commented Oct 10, 2025

Should we extend this idea for all coreutils (e.g mkdir) used at install time?

@naoNao89
Copy link
Contributor Author

i will soon investigate Gentoo and Linux From Scratch to understand the full extent of edge cases where system coreutils might be broken during rebuilds. This will help determine if we need similar logic for mkdir, cp, rm, or other utilities used at install time 💀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gentoo's emerge fails to install packages after replacing GNU coreutils

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载