mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge branch 'main' into test/cat-stdbuf-broken-pipe
This commit is contained in:
+75
-28
@@ -364,29 +364,15 @@ jobs:
|
||||
test -h /tmp/usr/local/bin/sha512sum
|
||||
test -h /tmp/usr/local/bin/shake128sum
|
||||
test -h /tmp/usr/local/bin/shake256sum
|
||||
- name: "`make install MULTICALL=y`"
|
||||
- name: "`make install MULTICALL=y LN=ln -svf`"
|
||||
shell: bash
|
||||
run: |
|
||||
set -x
|
||||
DESTDIR=/tmp/ make PROFILE=release MULTICALL=y install
|
||||
# Check that the utils are present
|
||||
test -f /tmp/usr/local/bin/coreutils
|
||||
# Check that hashsum symlinks are present
|
||||
test -h /tmp/usr/local/bin/b2sum
|
||||
test -h /tmp/usr/local/bin/b3sum
|
||||
test -h /tmp/usr/local/bin/md5sum
|
||||
test -h /tmp/usr/local/bin/sha1sum
|
||||
test -h /tmp/usr/local/bin/sha224sum
|
||||
test -h /tmp/usr/local/bin/sha256sum
|
||||
test -h /tmp/usr/local/bin/sha3-224sum
|
||||
test -h /tmp/usr/local/bin/sha3-256sum
|
||||
test -h /tmp/usr/local/bin/sha3-384sum
|
||||
test -h /tmp/usr/local/bin/sha3-512sum
|
||||
test -h /tmp/usr/local/bin/sha384sum
|
||||
test -h /tmp/usr/local/bin/sha3sum
|
||||
test -h /tmp/usr/local/bin/sha512sum
|
||||
test -h /tmp/usr/local/bin/shake128sum
|
||||
test -h /tmp/usr/local/bin/shake256sum
|
||||
DESTDIR=/tmp/ make PROFILE=release MULTICALL=y LN="ln -svf" install
|
||||
# Check that relative symlinks of hashsum are present
|
||||
[ $(readlink /tmp/usr/local/bin/b2sum) = coreutils ]
|
||||
[ $(readlink /tmp/usr/local/bin/md5sum) = coreutils ]
|
||||
[ $(readlink /tmp/usr/local/bin/sha512sum) = coreutils ]
|
||||
- name: "`make UTILS=XXX`"
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -483,9 +469,13 @@ jobs:
|
||||
run: |
|
||||
## `make install`
|
||||
make install DESTDIR=target/size-release/
|
||||
make install MULTICALL=y DESTDIR=target/size-multi-release/
|
||||
make install MULTICALL=y LN="ln -vf" DESTDIR=target/size-multi-release/
|
||||
# strip the results
|
||||
strip target/size*/usr/local/bin/*
|
||||
- name: Test for hardlinks
|
||||
shell: bash
|
||||
run: |
|
||||
[ $(stat -c %i target/size-multi-release/usr/local/bin/cp) = $(stat -c %i target/size-multi-release/usr/local/bin/coreutils) ]
|
||||
- name: Compute uutil release sizes
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -1199,11 +1189,14 @@ jobs:
|
||||
|
||||
test_separately:
|
||||
name: Separate Builds
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.job.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
job:
|
||||
- { os: ubuntu-latest , features: feat_os_unix }
|
||||
- { os: macos-latest , features: feat_os_macos }
|
||||
- { os: windows-latest , features: feat_os_windows }
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
@@ -1213,7 +1206,8 @@ jobs:
|
||||
- name: build and test all programs individually
|
||||
shell: bash
|
||||
run: |
|
||||
for f in $(util/show-utils.sh)
|
||||
CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ;
|
||||
for f in $(util/show-utils.sh ${CARGO_FEATURES_OPTION})
|
||||
do
|
||||
echo "Building and testing $f"
|
||||
cargo test -p "uu_$f" || exit 1
|
||||
@@ -1222,12 +1216,14 @@ jobs:
|
||||
test_all_features:
|
||||
name: Test all features separately
|
||||
needs: [ min_version, deps ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.job.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
# windows-latest - https://github.com/uutils/coreutils/issues/7044
|
||||
job:
|
||||
- { os: ubuntu-latest , features: feat_os_unix }
|
||||
- { os: macos-latest , features: feat_os_macos }
|
||||
# - { os: windows-latest , features: feat_os_windows } https://github.com/uutils/coreutils/issues/7044
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
@@ -1237,7 +1233,8 @@ jobs:
|
||||
- name: build and test all features individually
|
||||
shell: bash
|
||||
run: |
|
||||
for f in $(util/show-utils.sh)
|
||||
CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ;
|
||||
for f in $(util/show-utils.sh ${CARGO_FEATURES_OPTION})
|
||||
do
|
||||
echo "Running tests with --features=$f and --no-default-features"
|
||||
cargo test --features=$f --no-default-features
|
||||
@@ -1280,6 +1277,56 @@ jobs:
|
||||
- name: Lint with SELinux
|
||||
run: lima bash -c "cd work && cargo clippy --all-targets --features 'feat_selinux' -- -D warnings"
|
||||
|
||||
test_selinux_stubs:
|
||||
name: Build/SELinux-Stubs (Non-Linux)
|
||||
needs: [ min_version, deps ]
|
||||
runs-on: ${{ matrix.job.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
job:
|
||||
- { os: macos-latest , features: feat_os_macos }
|
||||
- { os: windows-latest , features: feat_os_windows }
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Build SELinux utilities as stubs
|
||||
run: cargo build -p uu_chcon -p uu_runcon
|
||||
- name: Verify stub binaries exist
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ runner.os }}" = "Windows" ]; then
|
||||
test -f target/debug/chcon.exe || exit 1
|
||||
test -f target/debug/runcon.exe || exit 1
|
||||
else
|
||||
test -f target/debug/chcon || exit 1
|
||||
test -f target/debug/runcon || exit 1
|
||||
fi
|
||||
- name: Verify workspace builds with stubs
|
||||
run: cargo build --features ${{ matrix.job.features }}
|
||||
|
||||
test_safe_traversal:
|
||||
name: Safe Traversal Security Check
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ min_version, deps ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Install strace
|
||||
run: sudo apt-get update && sudo apt-get install -y strace
|
||||
- name: Build utilities with safe traversal
|
||||
run: cargo build --release -p uu_rm -p uu_chmod -p uu_chown -p uu_chgrp -p uu_mv -p uu_du
|
||||
- name: Run safe traversal verification
|
||||
run: ./util/check-safe-traversal.sh
|
||||
|
||||
benchmarks:
|
||||
name: Run benchmarks (CodSpeed)
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -110,6 +110,7 @@ jobs:
|
||||
## Install/setup prerequisites
|
||||
case '${{ matrix.job.os }}' in
|
||||
ubuntu-*)
|
||||
sudo apt-get -y update
|
||||
# selinux and systemd headers needed to enable all features
|
||||
sudo apt-get -y install libselinux1-dev libsystemd-dev
|
||||
;;
|
||||
|
||||
+82
-120
@@ -1147,146 +1147,108 @@ jobs:
|
||||
run: |
|
||||
bash util/test_locale_regression.sh
|
||||
|
||||
l10n_locale_embedding_regression_test:
|
||||
name: L10n/Locale Embedding Regression Test
|
||||
l10n_locale_embedding_cat:
|
||||
name: L10n/Locale Embedding - Cat Utility
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
RUSTC_WRAPPER: "sccache"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
- name: Install/setup prerequisites
|
||||
shell: bash
|
||||
with:
|
||||
# Use different cache key for each build to avoid conflicts
|
||||
key: cat-locale-embedding
|
||||
- name: Install prerequisites
|
||||
run: sudo apt-get -y update && sudo apt-get -y install libselinux1-dev build-essential
|
||||
- name: Build cat with targeted locale embedding
|
||||
run: UUCORE_TARGET_UTIL=cat cargo build -p uu_cat --release
|
||||
- name: Verify cat locale count
|
||||
run: |
|
||||
## Install/setup prerequisites
|
||||
sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev build-essential
|
||||
- name: Build binaries for locale embedding test
|
||||
shell: bash
|
||||
run: |
|
||||
## Build individual utilities and multicall binary for locale embedding test
|
||||
echo "Building binaries with different locale embedding configurations..."
|
||||
mkdir -p target
|
||||
|
||||
# Build cat utility with targeted locale embedding
|
||||
echo "Building cat utility with targeted locale embedding..."
|
||||
echo "cat" > target/uucore_target_util.txt
|
||||
cargo build -p uu_cat --release
|
||||
|
||||
# Build ls utility with targeted locale embedding
|
||||
echo "Building ls utility with targeted locale embedding..."
|
||||
echo "ls" > target/uucore_target_util.txt
|
||||
cargo build -p uu_ls --release
|
||||
|
||||
# Build multicall binary (should have all locales)
|
||||
echo "Building multicall binary (should have all locales)..."
|
||||
echo "multicall" > target/uucore_target_util.txt
|
||||
cargo build --release
|
||||
|
||||
echo "✓ All binaries built successfully"
|
||||
env:
|
||||
RUST_BACKTRACE: "1"
|
||||
|
||||
- name: Analyze embedded locale files
|
||||
shell: bash
|
||||
run: |
|
||||
## Extract and analyze .ftl files embedded in each binary
|
||||
echo "=== Embedded Locale File Analysis ==="
|
||||
|
||||
# Analyze cat binary
|
||||
echo "--- cat binary embedded .ftl files ---"
|
||||
cat_ftl_files=$(strings target/release/cat | grep -o "[a-z_][a-z_]*/en-US\.ftl" | sort | uniq)
|
||||
cat_locales=$(echo "$cat_ftl_files" | wc -l)
|
||||
if [ -n "$cat_ftl_files" ]; then
|
||||
echo "$cat_ftl_files"
|
||||
else
|
||||
echo "(no locale keys found)"
|
||||
locale_file=$(find target/release/build -name "embedded_locales.rs" | head -1)
|
||||
if [ -z "$locale_file" ]; then
|
||||
echo "ERROR: Could not find embedded_locales.rs"
|
||||
exit 1
|
||||
fi
|
||||
echo "Total: $cat_locales files"
|
||||
echo
|
||||
|
||||
# Analyze ls binary
|
||||
echo "--- ls binary embedded .ftl files ---"
|
||||
ls_ftl_files=$(strings target/release/ls | grep -o "[a-z_][a-z_]*/en-US\.ftl" | sort | uniq)
|
||||
ls_locales=$(echo "$ls_ftl_files" | wc -l)
|
||||
if [ -n "$ls_ftl_files" ]; then
|
||||
echo "$ls_ftl_files"
|
||||
locale_count=$(grep -c '/en-US\.ftl' "$locale_file")
|
||||
echo "Cat binary has $locale_count embedded locales"
|
||||
if [ "$locale_count" -le 5 ]; then
|
||||
echo "✓ SUCCESS: Cat uses targeted locale embedding ($locale_count files)"
|
||||
else
|
||||
echo "(no locale keys found)"
|
||||
fi
|
||||
echo "Total: $ls_locales files"
|
||||
echo
|
||||
|
||||
# Analyze multicall binary
|
||||
echo "--- multicall binary embedded .ftl files (first 10) ---"
|
||||
multi_ftl_files=$(strings target/release/coreutils | grep -o "[a-z_][a-z_]*/en-US\.ftl" | sort | uniq)
|
||||
multi_locales=$(echo "$multi_ftl_files" | wc -l)
|
||||
if [ -n "$multi_ftl_files" ]; then
|
||||
echo "$multi_ftl_files" | head -10
|
||||
echo "... (showing first 10 of $multi_locales total files)"
|
||||
else
|
||||
echo "(no locale keys found)"
|
||||
fi
|
||||
echo
|
||||
|
||||
# Store counts for validation step
|
||||
echo "cat_locales=$cat_locales" >> $GITHUB_ENV
|
||||
echo "ls_locales=$ls_locales" >> $GITHUB_ENV
|
||||
echo "multi_locales=$multi_locales" >> $GITHUB_ENV
|
||||
|
||||
- name: Validate cat binary locale embedding
|
||||
shell: bash
|
||||
run: |
|
||||
## Validate that cat binary only embeds its own locale files
|
||||
echo "Validating cat binary locale embedding..."
|
||||
if [ "$cat_locales" -le 5 ]; then
|
||||
echo "✓ SUCCESS: cat binary uses targeted locale embedding ($cat_locales files)"
|
||||
else
|
||||
echo "✗ FAILURE: cat binary has too many embedded locale files ($cat_locales). Expected ≤ 5."
|
||||
echo "This indicates LOCALE EMBEDDING REGRESSION - all locales are being embedded instead of just the target utility's locale."
|
||||
echo "The optimization is not working correctly!"
|
||||
echo "✗ FAILURE: Cat has too many locale files ($locale_count). Expected ≤ 5"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Validate ls binary locale embedding
|
||||
shell: bash
|
||||
l10n_locale_embedding_ls:
|
||||
name: L10n/Locale Embedding - Ls Utility
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# Use different cache key for each build to avoid conflicts
|
||||
key: ls-locale-embedding
|
||||
- name: Install prerequisites
|
||||
run: sudo apt-get -y update && sudo apt-get -y install libselinux1-dev build-essential
|
||||
- name: Build ls with targeted locale embedding
|
||||
run: UUCORE_TARGET_UTIL=ls cargo build -p uu_ls --release
|
||||
- name: Verify ls locale count
|
||||
run: |
|
||||
## Validate that ls binary only embeds its own locale files
|
||||
echo "Validating ls binary locale embedding..."
|
||||
if [ "$ls_locales" -le 5 ]; then
|
||||
echo "✓ SUCCESS: ls binary uses targeted locale embedding ($ls_locales files)"
|
||||
locale_file=$(find target/release/build -name "embedded_locales.rs" | head -1)
|
||||
if [ -z "$locale_file" ]; then
|
||||
echo "ERROR: Could not find embedded_locales.rs"
|
||||
exit 1
|
||||
fi
|
||||
locale_count=$(grep -c '/en-US\.ftl' "$locale_file")
|
||||
echo "Ls binary has $locale_count embedded locales"
|
||||
if [ "$locale_count" -le 5 ]; then
|
||||
echo "✓ SUCCESS: Ls uses targeted locale embedding ($locale_count files)"
|
||||
else
|
||||
echo "✗ FAILURE: ls binary has too many embedded locale files ($ls_locales). Expected ≤ 5."
|
||||
echo "This indicates LOCALE EMBEDDING REGRESSION - all locales are being embedded instead of just the target utility's locale."
|
||||
echo "The optimization is not working correctly!"
|
||||
echo "✗ FAILURE: Ls has too many locale files ($locale_count). Expected ≤ 5"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Validate multicall binary locale embedding
|
||||
shell: bash
|
||||
l10n_locale_embedding_multicall:
|
||||
name: L10n/Locale Embedding - Multicall Binary
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# Use different cache key for each build to avoid conflicts
|
||||
key: multicall-locale-embedding
|
||||
- name: Install prerequisites
|
||||
run: sudo apt-get -y update && sudo apt-get -y install libselinux1-dev build-essential
|
||||
- name: Build multicall binary with all locales
|
||||
run: cargo build --release
|
||||
- name: Verify multicall locale count
|
||||
run: |
|
||||
## Validate that multicall binary embeds all utility locale files
|
||||
echo "Validating multicall binary locale embedding..."
|
||||
if [ "$multi_locales" -ge 80 ]; then
|
||||
echo "✓ SUCCESS: multicall binary has all locales ($multi_locales files)"
|
||||
locale_file=$(find target/release/build -name "embedded_locales.rs" | head -1)
|
||||
if [ -z "$locale_file" ]; then
|
||||
echo "ERROR: Could not find embedded_locales.rs"
|
||||
exit 1
|
||||
fi
|
||||
locale_count=$(grep -c '/en-US\.ftl' "$locale_file")
|
||||
echo "Multicall binary has $locale_count embedded locales"
|
||||
echo "First 10 locales:"
|
||||
grep -o '[a-z_][a-z_0-9]*/en-US\.ftl' "$locale_file" | head -10
|
||||
if [ "$locale_count" -ge 80 ]; then
|
||||
echo "✓ SUCCESS: Multicall has all locales ($locale_count files)"
|
||||
else
|
||||
echo "✗ FAILURE: multicall binary has too few embedded locale files ($multi_locales). Expected ≥ 80."
|
||||
echo "This indicates the multicall binary is not getting all required locales."
|
||||
echo "✗ FAILURE: Multicall has too few locale files ($locale_count). Expected ≥ 80"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Finalize locale embedding tests
|
||||
shell: bash
|
||||
run: |
|
||||
## Clean up and report overall test results
|
||||
rm -f test.txt target/uucore_target_util.txt
|
||||
echo "✓ All locale embedding regression tests passed"
|
||||
echo "Summary:"
|
||||
echo " - cat binary: $cat_locales locale files (targeted embedding)"
|
||||
echo " - ls binary: $ls_locales locale files (targeted embedding)"
|
||||
echo " - multicall binary: $multi_locales locale files (full embedding)"
|
||||
l10n_locale_embedding_regression_test:
|
||||
name: L10n/Locale Embedding Regression Test
|
||||
runs-on: ubuntu-latest
|
||||
needs: [l10n_locale_embedding_cat, l10n_locale_embedding_ls, l10n_locale_embedding_multicall]
|
||||
steps:
|
||||
- name: All locale embedding tests passed
|
||||
run: echo "✓ All locale embedding tests passed successfully"
|
||||
|
||||
Vendored
+1
@@ -34,6 +34,7 @@
|
||||
"docs/src/release-notes/**",
|
||||
"src/uu/*/benches/*.rs",
|
||||
"src/uucore/src/lib/features/benchmark.rs",
|
||||
"util/check-safe-traversal.sh",
|
||||
],
|
||||
|
||||
"enableGlobDot": true,
|
||||
|
||||
Generated
+20
-6
@@ -876,9 +876,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67773048316103656a637612c4a62477603b777d91d9c62ff2290f9cde178fdb"
|
||||
checksum = "59c9b8bdf64ee849747c1b12eb861d21aa47fa161564f48332f1afe2373bf899"
|
||||
dependencies = [
|
||||
"ctor-proc-macro",
|
||||
"dtor",
|
||||
@@ -886,9 +886,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ctor-proc-macro"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2931af7e13dc045d8e9d26afccc6fa115d64e115c9c84b1166288b46f6782c2"
|
||||
checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1"
|
||||
|
||||
[[package]]
|
||||
name = "ctrlc"
|
||||
@@ -3299,8 +3299,10 @@ version = "0.2.2"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"clap",
|
||||
"codspeed-divan-compat",
|
||||
"fluent",
|
||||
"memchr",
|
||||
"tempfile",
|
||||
"uucore",
|
||||
]
|
||||
|
||||
@@ -3501,7 +3503,9 @@ name = "uu_hashsum"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"codspeed-divan-compat",
|
||||
"fluent",
|
||||
"tempfile",
|
||||
"uucore",
|
||||
]
|
||||
|
||||
@@ -3688,10 +3692,12 @@ name = "uu_mv"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"codspeed-divan-compat",
|
||||
"fluent",
|
||||
"fs_extra",
|
||||
"indicatif",
|
||||
"libc",
|
||||
"tempfile",
|
||||
"thiserror 2.0.16",
|
||||
"uucore",
|
||||
"windows-sys 0.61.0",
|
||||
@@ -3865,8 +3871,10 @@ name = "uu_rm"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"codspeed-divan-compat",
|
||||
"fluent",
|
||||
"libc",
|
||||
"tempfile",
|
||||
"thiserror 2.0.16",
|
||||
"uucore",
|
||||
"windows-sys 0.61.0",
|
||||
@@ -3900,9 +3908,11 @@ version = "0.2.2"
|
||||
dependencies = [
|
||||
"bigdecimal",
|
||||
"clap",
|
||||
"codspeed-divan-compat",
|
||||
"fluent",
|
||||
"num-bigint",
|
||||
"num-traits",
|
||||
"tempfile",
|
||||
"thiserror 2.0.16",
|
||||
"uucore",
|
||||
]
|
||||
@@ -3967,8 +3977,10 @@ name = "uu_split"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"codspeed-divan-compat",
|
||||
"fluent",
|
||||
"memchr",
|
||||
"tempfile",
|
||||
"thiserror 2.0.16",
|
||||
"uucore",
|
||||
]
|
||||
@@ -4174,7 +4186,9 @@ name = "uu_unexpand"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"codspeed-divan-compat",
|
||||
"fluent",
|
||||
"tempfile",
|
||||
"thiserror 2.0.16",
|
||||
"unicode-width 0.2.1",
|
||||
"uucore",
|
||||
@@ -4943,9 +4957,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "5.1.1"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f852905151ac8d4d06fdca66520a661c09730a74c6d4e2b0f27b436b382e532"
|
||||
checksum = "eb2a05c7c36fde6c09b08576c9f7fb4cda705990f73b58fe011abf7dfb24168b"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"crc32fast",
|
||||
|
||||
+7
-4
@@ -1,7 +1,7 @@
|
||||
# coreutils (uutils)
|
||||
# * see the repository LICENSE, README, and CONTRIBUTING files for more information
|
||||
|
||||
# spell-checker:ignore (libs) bigdecimal datetime serde bincode gethostid kqueue libselinux mangen memmap uuhelp startswith constness expl unnested logind
|
||||
# spell-checker:ignore (libs) bigdecimal datetime serde bincode gethostid kqueue libselinux mangen memmap uuhelp startswith constness expl unnested logind cfgs
|
||||
|
||||
[package]
|
||||
name = "coreutils"
|
||||
@@ -314,7 +314,7 @@ clap_complete = "4.4"
|
||||
clap_mangen = "0.2"
|
||||
compare = "0.1.0"
|
||||
crossterm = "0.29.0"
|
||||
ctor = "0.5.0"
|
||||
ctor = "0.6.0"
|
||||
ctrlc = { version = "3.4.7", features = ["termination"] }
|
||||
divan = { package = "codspeed-divan-compat", version = "*" }
|
||||
dns-lookup = { version = "3.0.0" }
|
||||
@@ -381,7 +381,7 @@ walkdir = "2.5"
|
||||
winapi-util = "0.1.8"
|
||||
windows-sys = { version = "0.61.0", default-features = false }
|
||||
xattr = "1.3.1"
|
||||
zip = { version = "5.0.0", default-features = false, features = ["deflate"] }
|
||||
zip = { version = "6.0.0", default-features = false, features = ["deflate"] }
|
||||
|
||||
hex = "0.4.3"
|
||||
md-5 = "0.10.6"
|
||||
@@ -623,7 +623,6 @@ missing_panics_doc = "allow"
|
||||
# TODO remove when https://github.com/rust-lang/rust-clippy/issues/13774 is fixed
|
||||
large_stack_arrays = "allow"
|
||||
|
||||
use_self = "warn"
|
||||
needless_pass_by_value = "warn"
|
||||
semicolon_if_nothing_returned = "warn"
|
||||
single_char_pattern = "warn"
|
||||
@@ -639,6 +638,9 @@ pedantic = { level = "deny", priority = -1 }
|
||||
# Eventually the clippy settings from the `[lints]` section should be moved here.
|
||||
# In order to use these, all crates have `[lints] workspace = true` section.
|
||||
[workspace.lints.rust]
|
||||
# Allow "fuzzing" as a "cfg" condition name
|
||||
# https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
|
||||
#unused_qualifications = "warn" // TODO: fix warnings in uucore, then re-enable this lint
|
||||
|
||||
[workspace.lints.clippy]
|
||||
@@ -653,6 +655,7 @@ pedantic = { level = "deny", priority = -1 }
|
||||
all = { level = "warn", priority = -1 }
|
||||
cargo = { level = "warn", priority = -1 }
|
||||
pedantic = { level = "warn", priority = -1 }
|
||||
use_self = "warn" # nursery lint
|
||||
cargo_common_metadata = "allow" # 3240
|
||||
multiple_crate_versions = "allow" # 2882
|
||||
missing_errors_doc = "allow" # 1572
|
||||
|
||||
+11
-4
@@ -69,6 +69,13 @@ TOYBOX_SRC := $(TOYBOX_ROOT)/toybox-$(TOYBOX_VER)
|
||||
#------------------------------------------------------------------------
|
||||
OS ?= $(shell uname -s)
|
||||
|
||||
# Windows does not allow symlink by default.
|
||||
# Allow to override LN for AppArmor.
|
||||
ifeq ($(OS),Windows_NT)
|
||||
LN ?= ln -f
|
||||
endif
|
||||
LN ?= ln -sf
|
||||
|
||||
ifdef SELINUX_ENABLED
|
||||
override SELINUX_ENABLED := 0
|
||||
# Now check if we should enable it (only on non-Windows)
|
||||
@@ -482,18 +489,18 @@ endif
|
||||
ifeq (${MULTICALL}, y)
|
||||
$(INSTALL) -m 755 $(BUILDDIR)/coreutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)coreutils
|
||||
$(foreach prog, $(filter-out coreutils, $(INSTALLEES)), \
|
||||
cd $(INSTALLDIR_BIN) && ln -fs $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) $(newline) \
|
||||
cd $(INSTALLDIR_BIN) && $(LN) $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) $(newline) \
|
||||
)
|
||||
$(foreach prog, $(HASHSUM_PROGS), \
|
||||
cd $(INSTALLDIR_BIN) && ln -fs $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) $(newline) \
|
||||
cd $(INSTALLDIR_BIN) && $(LN) $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) $(newline) \
|
||||
)
|
||||
$(if $(findstring test,$(INSTALLEES)), cd $(INSTALLDIR_BIN) && ln -fs $(PROG_PREFIX)coreutils $(PROG_PREFIX)[)
|
||||
$(if $(findstring test,$(INSTALLEES)), cd $(INSTALLDIR_BIN) && $(LN) $(PROG_PREFIX)coreutils $(PROG_PREFIX)[)
|
||||
else
|
||||
$(foreach prog, $(INSTALLEES), \
|
||||
$(INSTALL) -m 755 $(BUILDDIR)/$(prog) $(INSTALLDIR_BIN)/$(PROG_PREFIX)$(prog) $(newline) \
|
||||
)
|
||||
$(foreach prog, $(HASHSUM_PROGS), \
|
||||
cd $(INSTALLDIR_BIN) && ln -fs $(PROG_PREFIX)hashsum $(PROG_PREFIX)$(prog) $(newline) \
|
||||
cd $(INSTALLDIR_BIN) && $(LN) $(PROG_PREFIX)hashsum $(PROG_PREFIX)$(prog) $(newline) \
|
||||
)
|
||||
$(if $(findstring test,$(INSTALLEES)), $(INSTALL) -m 755 $(BUILDDIR)/test $(INSTALLDIR_BIN)/$(PROG_PREFIX)[)
|
||||
endif
|
||||
|
||||
@@ -256,6 +256,11 @@ So, to install completions for `ls` on `bash` to
|
||||
cargo run completion ls bash > /usr/local/share/bash-completion/completions/ls
|
||||
```
|
||||
|
||||
Completion for prefixed `cp` with `uu-` on `zsh` is generated by
|
||||
```shell
|
||||
env PROG_PREFIX=uu- cargo run completion cp zsh
|
||||
```
|
||||
|
||||
### Manually install manpages
|
||||
|
||||
To generate manpages, the syntax is:
|
||||
|
||||
@@ -107,6 +107,8 @@ skip = [
|
||||
{ name = "rand_core", version = "0.6.4" },
|
||||
# utmp-classic
|
||||
{ name = "zerocopy", version = "0.7.35" },
|
||||
# zerocopy
|
||||
{ name = "zerocopy-derive", version = "0.7.35" },
|
||||
# divans/codspeed tooling
|
||||
{ name = "nix", version = "0.29.0" },
|
||||
]
|
||||
|
||||
@@ -42,6 +42,7 @@ basenc-help-base2msbf = bit string with most significant bit (msb) first
|
||||
basenc-help-z85 = ascii85-like encoding;
|
||||
when encoding, input length must be a multiple of 4;
|
||||
when decoding, input length must be a multiple of 5
|
||||
basenc-help-base58 = visually unambiguous base58 encoding
|
||||
|
||||
# Error messages
|
||||
basenc-error-missing-encoding-type = missing encoding type
|
||||
|
||||
@@ -37,6 +37,7 @@ basenc-help-base2msbf = chaîne de bits avec le bit de poids fort (msb) en premi
|
||||
basenc-help-z85 = encodage de type ascii85 ;
|
||||
lors de l'encodage, la longueur d'entrée doit être un multiple de 4 ;
|
||||
lors du décodage, la longueur d'entrée doit être un multiple de 5
|
||||
basenc-help-base58 = encodage base58 visuellement non ambigu
|
||||
|
||||
# Messages d'erreur
|
||||
basenc-error-missing-encoding-type = type d'encodage manquant
|
||||
|
||||
@@ -12,8 +12,8 @@ use std::io::{self, ErrorKind, Read, Seek};
|
||||
use std::path::{Path, PathBuf};
|
||||
use uucore::display::Quotable;
|
||||
use uucore::encoding::{
|
||||
BASE2LSBF, BASE2MSBF, Base64SimdWrapper, EncodingWrapper, Format, SupportsFastDecodeAndEncode,
|
||||
Z85Wrapper,
|
||||
BASE2LSBF, BASE2MSBF, Base58Wrapper, Base64SimdWrapper, EncodingWrapper, Format,
|
||||
SupportsFastDecodeAndEncode, Z85Wrapper,
|
||||
for_base_common::{BASE32, BASE32HEX, BASE64URL, HEXUPPER_PERMISSIVE},
|
||||
};
|
||||
use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
|
||||
@@ -285,6 +285,7 @@ pub fn get_supports_fast_decode_and_encode(
|
||||
b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=_-",
|
||||
)),
|
||||
Format::Z85 => Box::from(Z85Wrapper {}),
|
||||
Format::Base58 => Box::from(Base58Wrapper {}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ fn get_encodings() -> Vec<(&'static str, Format, String)> {
|
||||
translate!("basenc-help-base2msbf"),
|
||||
),
|
||||
("z85", Format::Z85, translate!("basenc-help-z85")),
|
||||
("base58", Format::Base58, translate!("basenc-help-base58")),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ impl LineNumber {
|
||||
|
||||
buf[print_start..].copy_from_slice(init_str.as_bytes());
|
||||
|
||||
LineNumber {
|
||||
Self {
|
||||
buf,
|
||||
print_start,
|
||||
num_start,
|
||||
|
||||
@@ -1,2 +1,12 @@
|
||||
#![cfg(target_os = "linux")]
|
||||
// On non-Linux targets, provide a stub main to keep the binary target present
|
||||
// and the workspace buildable. Using item-level cfg avoids excluding the crate
|
||||
// entirely (via #![cfg(...)]), which can break tooling and cross builds that
|
||||
// expect this binary to exist even when it's a no-op off Linux.
|
||||
#[cfg(target_os = "linux")]
|
||||
uucore::bin!(uu_chcon);
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn main() {
|
||||
eprintln!("chcon: SELinux is not supported on this platform");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ enum FileNumber {
|
||||
impl FileNumber {
|
||||
fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
FileNumber::One => "1",
|
||||
FileNumber::Two => "2",
|
||||
Self::One => "1",
|
||||
Self::Two => "2",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
#[cfg(windows)]
|
||||
use std::borrow::Cow;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::convert::identity;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::fs::{self, exists};
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf, StripPrefixError};
|
||||
|
||||
@@ -20,10 +21,9 @@ use uucore::error::UIoError;
|
||||
use uucore::fs::{
|
||||
FileInformation, MissingHandling, ResolveMode, canonicalize, path_ends_with_terminator,
|
||||
};
|
||||
use uucore::translate;
|
||||
|
||||
use uucore::show;
|
||||
use uucore::show_error;
|
||||
use uucore::translate;
|
||||
use uucore::uio_error;
|
||||
use walkdir::{DirEntry, WalkDir};
|
||||
|
||||
@@ -194,15 +194,23 @@ impl Entry {
|
||||
get_local_to_root_parent(&source_absolute, context.root_parent.as_deref())?;
|
||||
if no_target_dir {
|
||||
let source_is_dir = source.is_dir();
|
||||
if path_ends_with_terminator(context.target) && source_is_dir {
|
||||
if path_ends_with_terminator(context.target)
|
||||
&& source_is_dir
|
||||
&& !exists(context.target).is_ok_and(identity)
|
||||
{
|
||||
if let Err(e) = fs::create_dir_all(context.target) {
|
||||
eprintln!(
|
||||
"{}",
|
||||
translate!("cp-error-failed-to-create-directory", "error" => e)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
descendant = descendant.strip_prefix(context.root)?.to_path_buf();
|
||||
} else if let Some(stripped) = context
|
||||
.root
|
||||
.components()
|
||||
.next_back()
|
||||
.and_then(|stripped| descendant.strip_prefix(stripped).ok())
|
||||
{
|
||||
descendant = stripped.to_path_buf();
|
||||
}
|
||||
} else if context.root == Path::new(".") && context.target.is_dir() {
|
||||
// Special case: when copying current directory (.) to an existing directory,
|
||||
|
||||
+2
-2
@@ -175,11 +175,11 @@ impl Default for ReflinkMode {
|
||||
fn default() -> Self {
|
||||
#[cfg(any(target_os = "linux", target_os = "android", target_os = "macos"))]
|
||||
{
|
||||
ReflinkMode::Auto
|
||||
Self::Auto
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "macos")))]
|
||||
{
|
||||
ReflinkMode::Never
|
||||
Self::Never
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,15 @@ memchr = { workspace = true }
|
||||
bstr = { workspace = true }
|
||||
fluent = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
divan = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
uucore = { workspace = true, features = ["benchmark"] }
|
||||
|
||||
[[bin]]
|
||||
name = "cut"
|
||||
path = "src/main.rs"
|
||||
|
||||
[[bench]]
|
||||
name = "cut_bench"
|
||||
harness = false
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// This file is part of the uutils coreutils package.
|
||||
//
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
use divan::{Bencher, black_box};
|
||||
use uu_cut::uumain;
|
||||
use uucore::benchmark::{run_util_function, setup_test_file, text_data};
|
||||
|
||||
/// Benchmark cutting specific byte ranges
|
||||
#[divan::bench]
|
||||
fn cut_bytes(bencher: Bencher) {
|
||||
let data = text_data::generate_by_lines(100_000, 80);
|
||||
let file_path = setup_test_file(&data);
|
||||
|
||||
bencher.bench(|| {
|
||||
black_box(run_util_function(
|
||||
uumain,
|
||||
&["-b", "1-20", file_path.to_str().unwrap()],
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
/// Benchmark cutting specific character ranges
|
||||
#[divan::bench]
|
||||
fn cut_characters(bencher: Bencher) {
|
||||
let data = text_data::generate_mixed_data(100_000);
|
||||
let file_path = setup_test_file(&data);
|
||||
|
||||
bencher.bench(|| {
|
||||
black_box(run_util_function(
|
||||
uumain,
|
||||
&["-c", "5-30", file_path.to_str().unwrap()],
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
/// Benchmark cutting fields with tab delimiter
|
||||
#[divan::bench]
|
||||
fn cut_fields_tab(bencher: Bencher) {
|
||||
let mut data = Vec::new();
|
||||
for i in 0..100_000 {
|
||||
let line = format!("field1\tfield2_{i}\tfield3\tfield4\tfield5\n");
|
||||
data.extend_from_slice(line.as_bytes());
|
||||
}
|
||||
let file_path = setup_test_file(&data);
|
||||
|
||||
bencher.bench(|| {
|
||||
black_box(run_util_function(
|
||||
uumain,
|
||||
&["-f", "2,4", file_path.to_str().unwrap()],
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
/// Benchmark cutting fields with custom delimiter
|
||||
#[divan::bench]
|
||||
fn cut_fields_custom_delim(bencher: Bencher) {
|
||||
let mut data = Vec::new();
|
||||
for i in 0..100_000 {
|
||||
let line = format!("apple,banana_{i},cherry,date,elderberry\n");
|
||||
data.extend_from_slice(line.as_bytes());
|
||||
}
|
||||
let file_path = setup_test_file(&data);
|
||||
|
||||
bencher.bench(|| {
|
||||
black_box(run_util_function(
|
||||
uumain,
|
||||
&["-d", ",", "-f", "1,3,5", file_path.to_str().unwrap()],
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
fn main() {
|
||||
divan::main();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user