+
Skip to content

Conversation

naoNao89
Copy link
Contributor

fixes #8880

Old autoconf (< 2.72) only trusts “GNU coreutils” in mkdir --version and can fall back to install-sh. This adds a tiny runtime heuristic so mkdir reports “GNU coreutils” only when it looks like an autoconf-style version probe, and otherwise keeps the honest “uutils coreutils”.

What I changed

  • mkdir only: when called as a non-interactive --version and we detect an autoconf context (env vars or configure files, plus a Linux /proc hint), switch branding to “GNU coreutils”
  • default remains “uutils coreutils” for normal use
  • normalize argv[0] to a basename so version prints “mkdir”, not an absolute path

Why
This makes autoconf 2.69 pick MKDIR_P='mkdir -p' instead of falling back to install-sh, addressing #8880. Autoconf 2.72+ is unchanged (it already uses mkdir -p).

Scope

  • Only affects mkdir
  • Linux /proc check is cfg-gated; portable elsewhere

Quick check

  • Debian 11 (autoconf 2.69): MKDIR_P='/usr/bin/mkdir -p'
  • Ubuntu 25.10 (autoconf 2.72): still uses mkdir -p
  • Normal user runs: still shows “mkdir (uutils coreutils) …”

… default

Fixes uutils#8880.
- Default --version header to '(uutils coreutils)'; allow override for autoconf via UUTILS_VERSION_BRAND
- Keep autoconf compatibility by setting UUTILS_VERSION_BRAND='GNU coreutils' when needed
- Normalize program name to basename so header starts with 'mkdir ...'
- Relax docs CI to accept both GNU/uutils brand strings
- Relax mkdir test to accept both brand tokens
- No behavior changes; display only
…tests

Default to honest '(uutils coreutils)' branding. Emit '(GNU coreutils)' only for likely autoconf probes of 'mkdir --version' when env/dir hints are present (and linux-only /proc best-effort). Normalize to basename already in place. Adjust tests to simulate autoconf env for compatibility assertion. Clippy and fmt clean; full test suite passes locally.
Remove UUTILS_VERSION_BRAND runtime override path. Keep compile-time option_env! for packagers if needed. Tests updated to remove env override case; autoconf compatibility still validated via autoconf-like env hints. fmt/clippy/tests green.
The branding detection mechanism implemented to fix issue uutils#8880
is only needed for autoconf < 2.72. Modern distributions (Ubuntu 25.10+)
ship with autoconf >= 2.72, which always uses mkdir -p regardless of
branding, making this workaround potentially unnecessary.

Added clear documentation:
- TODO(uutils#8880) comment explaining when this code could be removed
- Detailed function documentation for should_emit_gnu_brand()
- Decision point for maintainers to consider removal if supporting
  only modern autoconf versions

This allows future maintainers to easily identify and remove the
workaround if the project decides not to support autoconf < 2.72.
@sylvestre
Copy link
Contributor

Sorry but it is a way too complex change for a legacy compat.

@naoNao89
Copy link
Contributor Author

repro

$ podman --connection podman-machine-default run --rm \
  -v "$HOME/.cache/uutils-test/coreutils-linux-bullseye:/usr/bin/mkdir:ro" \
  docker.io/library/debian:11 \
  bash -c '
    apt-get update -y >/dev/null 2>&1
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      autoconf automake libtool m4 grep ca-certificates >/dev/null 2>&1

    autoconf --version | head -n1
    /usr/bin/mkdir --version | head -n1

    cd /tmp && rm -rf test && mkdir -p test/build-aux
    cd test
    cp /usr/share/automake-*/install-sh build-aux/ 2>/dev/null
    printf "AC_INIT([test],[0.1])\nAC_CONFIG_AUX_DIR([build-aux])\nAC_PROG_MKDIR_P\nAC_OUTPUT\n" > configure.ac
    autoconf >/dev/null 2>&1
    ./configure 2>&1 | grep "checking for a"
    grep "^MKDIR_P=" config.log
  '
autoconf (GNU Autoconf) 2.69
mkdir (GNU coreutils) 0.2.2
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
MKDIR_P='/usr/bin/mkdir -p'

Ubuntu 25.10

podman --connection podman-machine-default run --rm \
  -v "$HOME/.cache/uutils-test/coreutils-linux:/usr/bin/mkdir:ro" \
  docker.io/library/ubuntu:25.10 \
  bash -c '
    apt-get update -y >/dev/null 2>&1
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      autoconf automake libtool m4 grep ca-certificates >/dev/null 2>&1

    autoconf --version | head -n1
    /usr/bin/mkdir --version | head -n1

    cd /tmp && rm -rf test && mkdir -p test/build-aux
    cd test
    cp /usr/share/automake-*/install-sh build-aux/ 2>/dev/null
    printf "AC_INIT([test],[0.1])\nAC_CONFIG_AUX_DIR([build-aux])\nAC_PROG_MKDIR_P\nAC_OUTPUT\n" > configure.ac
    autoconf >/dev/null 2>&1
    ./configure 2>&1 | grep "checking for a"
    grep "^MKDIR_P=" config.log
  '
autoconf (GNU Autoconf) 2.72
mkdir (GNU coreutils) 0.2.2
checking for a race-free mkdir -p... /usr/bin/mkdir -p
MKDIR_P='/usr/bin/mkdir -p'

@naoNao89 naoNao89 marked this pull request as draft October 13, 2025 08:16
Copy link

codspeed-hq bot commented Oct 13, 2025

CodSpeed Performance Report

Merging #8896 will degrade performances by 3.42%

Comparing naoNao89:fix/autoconf-mkdir-version-8880 (0269583) with main (16af7d4)

Summary

⚡ 1 improvement
❌ 8 regressions
✅ 97 untouched
⏩ 73 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
b64_decode_ignore_garbage_synthetic 145.6 µs 149.7 µs -2.79%
b64_encode_synthetic 142 µs 145.3 µs -2.28%
mv_single_file 120.5 ms 124.7 ms -3.37%
numfmt_padding[(10000, 50)] 48.4 ms 47.1 ms +2.63%
rm_multiple_files 2.2 ms 2.3 ms -2.3%
rm_single_file 100.1 ms 103.5 ms -3.24%
sort_random_strings 55.3 ms 56.8 ms -2.66%
split_bytes 482.3 µs 499.4 µs -3.42%
wc_bytes_synthetic[500] 162.8 µs 166.3 µs -2.12%

Footnotes

  1. 73 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link

GNU testsuite comparison:

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

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.

old configure (with autoconf ≥ 2.72) scripts don't detect mkdir -p as race-free

2 participants

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