From 9d767c9ebe4a822efbc377bd2a46d912bb4ac301 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Sat, 8 Aug 2026 19:42:05 +0100 Subject: [PATCH 1/2] fix MD037 markdown lint https://github.com/DavidAnson/markdownlint/blob/main/doc/md034.md --- .markdownlint.yaml | 2 +- docs/src/release-notes/0.0.23.md | 2 +- docs/src/release-notes/0.5.0.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.markdownlint.yaml b/.markdownlint.yaml index 57cf850a4e..46a3fe3df1 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,5 +1,5 @@ -# Disable 'Line length'. Doesn't provide much values MD013: false # Disable 'Fenced code blocks should have a language specified' +MD037: true # Doesn't provide much in src/ to enforce it MD040: false diff --git a/docs/src/release-notes/0.0.23.md b/docs/src/release-notes/0.0.23.md index 5104f3fd41..880c7571c7 100644 --- a/docs/src/release-notes/0.0.23.md +++ b/docs/src/release-notes/0.0.23.md @@ -88,7 +88,7 @@ For more details, visit [https://github.com/uutils/coreutils-tracking/](https:// ### mv * mv: make UpdateMode public by @dmatos2012 in https://github.com/uutils/coreutils/pull/5428 * mv: Fix stderr output mv file into dir and dir into file where both are files by @mickvangelderen in https://github.com/uutils/coreutils/pull/5464 -* mv: rename canonized_* -> canonicalized_* by @cakebaker in https://github.com/uutils/coreutils/pull/5454 +* mv: rename `canonized_*` -> `canonicalized_*` by @cakebaker in https://github.com/uutils/coreutils/pull/5454 * mv: moving directory itself should fail by @dmatos2012 in https://github.com/uutils/coreutils/pull/5429 ### pathchk diff --git a/docs/src/release-notes/0.5.0.md b/docs/src/release-notes/0.5.0.md index 3f1c40c652..696777a411 100644 --- a/docs/src/release-notes/0.5.0.md +++ b/docs/src/release-notes/0.5.0.md @@ -287,7 +287,7 @@ We are excited to announce the release of **Rust Coreutils 0.5.0** — a signifi * chore(deps): update rust crate clap to v4.5.52 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9316 * chore(deps): update rust crate clap_complete to v4.5.61 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9343 * chore(deps): update rust crate clap to v4.5.53 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9340 -* GNUmakefile: Use libstdbuf.* instead of libstdbuf* by @oech3 in https://github.com/uutils/coreutils/pull/9345 +* GNUmakefile: Use `libstdbuf.*` instead of `libstdbuf*` by @oech3 in https://github.com/uutils/coreutils/pull/9345 * chore(deps): update actions/checkout action to v6 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9416 * chore(deps): update rust crate parse_datetime to v0.13.3 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9434 * chore(deps): update rust crate hostname to v0.4.2 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9515 From 4f2e17afdb909a01879cf38a100a56d0b2c4a438 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Sat, 8 Aug 2026 19:47:09 +0100 Subject: [PATCH 2/2] fix MD031 markdown lint https://github.com/DavidAnson/markdownlint/blob/main/doc/md031.md --- .markdownlint.yaml | 1 + README.md | 7 +++++++ docs/src/extensions.md | 3 +++ docs/src/performance.md | 5 +++++ docs/src/release-notes/0.0.13.md | 1 + src/uu/rm/BENCHMARKING.md | 1 + src/uu/seq/BENCHMARKING.md | 6 ++++++ src/uu/sort/BENCHMARKING.md | 3 +++ 8 files changed, 27 insertions(+) diff --git a/.markdownlint.yaml b/.markdownlint.yaml index 46a3fe3df1..9ebec71082 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,5 +1,6 @@ MD013: false # Disable 'Fenced code blocks should have a language specified' +MD031: true MD037: true # Doesn't provide much in src/ to enforce it MD040: false diff --git a/README.md b/README.md index 7f4be4e17f..8e79a3dd3d 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ cargo build --release --target wasm32-wasip1 --no-default-features --features fe To build SELinux-specific features, including `chcon` and `runcon`, ensure that `libselinux` and `libclang` are installed on your system. Then, run the following command: + ``` cargo build --release --features unix,feat_selinux ``` @@ -135,9 +136,11 @@ cargo build --release --features unix,feat_selinux To speed up the checksum utilities (`md5sum`, `sha1sum`, `sha224sum`, `sha256sum`, `sha384sum`, `sha512sum`, and `cksum`) by using OpenSSL's `libcrypto` instead of the pure-Rust digest crates, enable the `openssl` feature: + ``` cargo build --release --features unix,openssl ``` + By default OpenSSL is built from source and statically linked into the binary (mirroring how `expr` links `oniguruma`), so no runtime dependency on system libcrypto/libssl is added. To link dynamically against the system @@ -161,6 +164,7 @@ If you want to build the utilities as individual binaries, that is also possible ```shell cargo build --release --bins --workspace --exclude coreutils --exclude uu_runcon --exclude uu_chcon ``` + Each utility is contained in its own package within the main repository, named "uu_UTILNAME". To build selected individual utilities, use the `--package` [aka `-p`] option. For example: @@ -274,11 +278,13 @@ The `uudoc` binary generates completions for the `bash`, `elvish`, `fish`, `powershell` and `zsh` shells to stdout. Install `uudoc` by + ```shell cargo install --bin uudoc --features uudoc --path . ``` Then use the installed binary: + ```shell uudoc completion ``` @@ -291,6 +297,7 @@ uudoc completion ls bash > /usr/local/share/bash-completion/completions/ls.bash ``` Completion for prefixed `cp` with `uu-` on `zsh` is generated by + ```shell env PROG_PREFIX=uu- uudoc completion cp zsh ``` diff --git a/docs/src/extensions.md b/docs/src/extensions.md index bb0dfff061..ba60f549b7 100644 --- a/docs/src/extensions.md +++ b/docs/src/extensions.md @@ -82,6 +82,7 @@ numbers. GNU coreutils uses `long double`, whose actual size may be [double prec [quadruple precision 128-bit float](https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format) (e.g. arm64). Practically, this means that printing a number with high precision will remain exact: + ``` printf "%.48f\n" 0.1 0.100000000000000000000000000000000000000000000000 << uutils on all platforms @@ -116,6 +117,7 @@ before the decimal point, 15 after). Practically, this means that the default hexadecimal floating point output is identical to x86(-64) GNU coreutils: + ``` printf "%a\n" 0.1 0xc.ccccccccccccccdp-7 << uutils on all platforms @@ -126,6 +128,7 @@ printf "%a\n" 0.1 We _can_ print an arbitrary number of digits if a larger precision is requested, and the leading digit will still be in the `0x8`-`0xf` range: + ``` printf "%.32a\n" 0.1 0xc.cccccccccccccccccccccccccccccccdp-7 << uutils on all platforms diff --git a/docs/src/performance.md b/docs/src/performance.md index 975a743abe..fb131bde0a 100644 --- a/docs/src/performance.md +++ b/docs/src/performance.md @@ -116,6 +116,7 @@ samply record --rate 1000 ./target/debug/coreutils seq 1 1000 The output using the `debug` profile might be easier to understand, but the performance characteristics may be somewhat different from `release` profile that we _actually_ care about. Consider using the `profiling` profile, that compiles in `release` mode but with debug symbols. For example: + ```bash cargo build --profile profiling -p uu_ls samply record -r 10000 target/profiling/ls -lR /var .git .git .git > /dev/null @@ -124,6 +125,7 @@ samply record -r 10000 target/profiling/ls -lR /var .git .git .git > /dev/null ## Workflow: Measuring Performance Improvements 1. **Establish baselines**: + ```bash hyperfine --warmup 3 \ "/usr/bin/sort large_file.txt" \ @@ -131,6 +133,7 @@ samply record -r 10000 target/profiling/ls -lR /var .git .git .git > /dev/null ``` 2. **Identify bottlenecks**: + ```bash samply record ./our-sort-v1 large_file.txt ``` @@ -138,6 +141,7 @@ samply record -r 10000 target/profiling/ls -lR /var .git .git .git > /dev/null 3. **Make targeted improvements** based on profiling data 4. **Verify improvements**: + ```bash hyperfine --warmup 3 \ "/usr/bin/sort large_file.txt" \ @@ -146,6 +150,7 @@ samply record -r 10000 target/profiling/ls -lR /var .git .git .git > /dev/null ``` 5. **Document performance changes** with concrete numbers + ```bash hyperfine --export-markdown file.md [...] ``` diff --git a/docs/src/release-notes/0.0.13.md b/docs/src/release-notes/0.0.13.md index 7e1829c4ee..98bb0101d9 100644 --- a/docs/src/release-notes/0.0.13.md +++ b/docs/src/release-notes/0.0.13.md @@ -12,6 +12,7 @@ The highlights of this release are: * Many improvements and fixes in many utils. In particular, `cp`, `dd`, `df`, `split` and `tr` have gotten very large improvements and are much more compatible with GNU. * [Online user documentation](https://uutils.github.io/coreutils-docs/user/) featuring installation instructions, descriptions, flags, options and examples. * We now use `clap` 3, which gives the `--help` output a new look and enables abbreviations of long arguments. For example: + ```sh ls --color # already worked pre 0.0.13 ls --col # any unambiguous shorthand now also works diff --git a/src/uu/rm/BENCHMARKING.md b/src/uu/rm/BENCHMARKING.md index 154115ab2c..b786f81208 100644 --- a/src/uu/rm/BENCHMARKING.md +++ b/src/uu/rm/BENCHMARKING.md @@ -41,6 +41,7 @@ hyperfine --prepare "cp -r $test_dir tmp_d" "rm -rf tmp_d" "target/release/core [samply](https://github.com/mstange/samply) is one option for simply creating flamegraphs. It uses the Firefox profiler as a UI. To install: + ```bash cargo install samply ``` diff --git a/src/uu/seq/BENCHMARKING.md b/src/uu/seq/BENCHMARKING.md index 5758d2a77f..662a86cd9c 100644 --- a/src/uu/seq/BENCHMARKING.md +++ b/src/uu/seq/BENCHMARKING.md @@ -31,6 +31,7 @@ outputs (which is probably the most common use case for `seq`). Specifying a format or fixed width will slow down the execution a lot (~15-20 times on GNU `seq`): + ```shell hyperfine -L seq seq,target/release/seq "{seq} -f%g 1000000" hyperfine -L seq seq,target/release/seq "{seq} -w 1000000" @@ -38,6 +39,7 @@ hyperfine -L seq seq,target/release/seq "{seq} -w 1000000" Floating point increments, or any negative bound, also degrades the performance (~10-15 times on GNU `seq`): + ```shell hyperfine -L seq seq,./target/release/seq "{seq} 0 0.000001 1" hyperfine -L seq seq,./target/release/seq "{seq} -100 1 1000000" @@ -49,6 +51,7 @@ as GNU `seq` may not provide the same precision (`uutils` version of `seq` provides arbitrary precision, while GNU `seq` appears to be limited to `long double` on the given platform, i.e. 64/80/128-bit float): + ```shell hyperfine -L seq seq,target/release/seq "{seq} -f%.30f 0 0.000001 1" ``` @@ -66,10 +69,13 @@ performance compared with GNU `seq`. ### Directly print strings As expected, directly printing a string: + ```rust stdout.write_all(separator.as_bytes())? ``` + is quite a bit faster than using format to do the same operation: + ```rust write!(stdout, "{separator}")? ``` diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index ff87c1feb2..73a63d144a 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -25,12 +25,15 @@ Run `cargo build --release` before benchmarking after you make a change! ## Sorting numbers - Generate a list of numbers: + ``` shuf -i 1-1000000 -n 1000000 > shuffled_numbers.txt # or seq 1 1000000 | sort -R > shuffled_numbers.txt ``` + - Benchmark numeric sorting with hyperfine + ``` hyperfine --warmup 3 \ '/tmp/gnu-sort -n /tmp/shuffled_numbers.txt'