Skip to content

Commit 0269583

Browse files
committed
docs: add TODO comment for autoconf compatibility workaround
The branding detection mechanism implemented to fix issue #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(#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.
1 parent 0dc8a65 commit 0269583

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

src/uucore/src/lib/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,21 @@ macro_rules! crate_version {
234234
/// all occurrences of `{}` with the execution phrase and returns the resulting
235235
/// `String`. It does **not** support more advanced formatting features such
236236
/// as `{0}`.
237+
// TODO(#8880): Autoconf compatibility workaround - consider removal
238+
//
239+
// This code implements runtime branding detection to work around autoconf < 2.72
240+
// not recognizing uutils mkdir as race-free. Modern autoconf (>= 2.72) always
241+
// uses mkdir -p regardless of branding, making this workaround unnecessary for:
242+
// - Ubuntu 25.10+ (ships with autoconf 2.72)
243+
// - Any distro with autoconf >= 2.72
244+
//
245+
// DECISION POINT: If the project decides to only support modern autoconf versions,
246+
// this entire branding detection mechanism (functions below through line ~367)
247+
// can be removed and replaced with a simple static "uutils coreutils" branding.
248+
//
249+
// See: https://github.com/uutils/coreutils/issues/8880
250+
// See: https://github.com/autotools-mirror/autoconf/commit/d081ac3
251+
237252
/// Return true if the current directory (or parents) looks like a configure tree
238253
fn looks_like_configure_dir() -> bool {
239254
let mut current_dir = env::current_dir().ok();
@@ -318,6 +333,17 @@ fn looks_like_mkdir_version_probe() -> bool {
318333
}
319334

320335
/// Decide if we should emit GNU branding for compatibility
336+
///
337+
/// Returns true only when:
338+
/// 1. Utility is "mkdir"
339+
/// 2. Called as `mkdir --version` non-interactively (likely autoconf probe)
340+
/// 3. Autoconf environment detected (env vars, configure files, or parent process)
341+
///
342+
/// This ensures honest "uutils coreutils" branding for normal users while
343+
/// providing "GNU coreutils" branding only when autoconf is actively probing.
344+
///
345+
/// NOTE: This entire mechanism exists only for autoconf < 2.72 compatibility.
346+
/// See TODO(#8880) comment above for removal consideration.
321347
fn should_emit_gnu_brand() -> bool {
322348
// Only for mkdir
323349
if util_name() != "mkdir" {

0 commit comments

Comments
 (0)