Skip to content

Commit b263838

Browse files
authored
Merge branch 'main' into sort-perf
2 parents 48257d7 + 909da50 commit b263838

202 files changed

Lines changed: 9119 additions & 2968 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/CICD.yml

Lines changed: 83 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -364,35 +364,26 @@ jobs:
364364
test -h /tmp/usr/local/bin/sha512sum
365365
test -h /tmp/usr/local/bin/shake128sum
366366
test -h /tmp/usr/local/bin/shake256sum
367-
- name: "`make install MULTICALL=y`"
367+
- name: "`make install MULTICALL=y LN=ln -svf`"
368368
shell: bash
369369
run: |
370370
set -x
371-
DESTDIR=/tmp/ make PROFILE=release MULTICALL=y install
372-
# Check that the utils are present
373-
test -f /tmp/usr/local/bin/coreutils
374-
# Check that hashsum symlinks are present
375-
test -h /tmp/usr/local/bin/b2sum
376-
test -h /tmp/usr/local/bin/b3sum
377-
test -h /tmp/usr/local/bin/md5sum
378-
test -h /tmp/usr/local/bin/sha1sum
379-
test -h /tmp/usr/local/bin/sha224sum
380-
test -h /tmp/usr/local/bin/sha256sum
381-
test -h /tmp/usr/local/bin/sha3-224sum
382-
test -h /tmp/usr/local/bin/sha3-256sum
383-
test -h /tmp/usr/local/bin/sha3-384sum
384-
test -h /tmp/usr/local/bin/sha3-512sum
385-
test -h /tmp/usr/local/bin/sha384sum
386-
test -h /tmp/usr/local/bin/sha3sum
387-
test -h /tmp/usr/local/bin/sha512sum
388-
test -h /tmp/usr/local/bin/shake128sum
389-
test -h /tmp/usr/local/bin/shake256sum
371+
DESTDIR=/tmp/ make PROFILE=release MULTICALL=y LN="ln -svf" install
372+
# Check that relative symlinks of hashsum are present
373+
[ $(readlink /tmp/usr/local/bin/b2sum) = coreutils ]
374+
[ $(readlink /tmp/usr/local/bin/md5sum) = coreutils ]
375+
[ $(readlink /tmp/usr/local/bin/sha512sum) = coreutils ]
390376
- name: "`make UTILS=XXX`"
391377
shell: bash
392378
run: |
393379
set -x
394380
# Regression-test for https://github.com/uutils/coreutils/issues/8701
395381
make UTILS="rm chmod chown chgrp mv du"
382+
# Verifies that
383+
# 1. there is no "error: none of the selected packages contains this
384+
# feature: feat_external_libstdbuf"
385+
# 2. the makefile doesn't try to install libstdbuf even though stdbuf is skipped
386+
DESTDIR=/tmp/ make SKIP_UTILS="stdbuf" install
396387
397388
build_rust_stable:
398389
name: Build/stable
@@ -483,9 +474,13 @@ jobs:
483474
run: |
484475
## `make install`
485476
make install DESTDIR=target/size-release/
486-
make install MULTICALL=y DESTDIR=target/size-multi-release/
477+
make install MULTICALL=y LN="ln -vf" DESTDIR=target/size-multi-release/
487478
# strip the results
488479
strip target/size*/usr/local/bin/*
480+
- name: Test for hardlinks
481+
shell: bash
482+
run: |
483+
[ $(stat -c %i target/size-multi-release/usr/local/bin/cp) = $(stat -c %i target/size-multi-release/usr/local/bin/coreutils) ]
489484
- name: Compute uutil release sizes
490485
shell: bash
491486
run: |
@@ -782,6 +777,9 @@ jobs:
782777
# We also create a couple optional files pinky looks for
783778
touch /home/runner/.project
784779
echo "foo" > /home/runner/.plan
780+
# add user with digital username for testing with issue #7787
781+
echo 200:x:2000:2000::/home/200:/bin/bash | sudo tee -a /etc/passwd
782+
echo 200:x:2000: | sudo tee -a /etc/group
785783
;;
786784
esac
787785
- uses: taiki-e/install-action@v2
@@ -1156,6 +1154,9 @@ jobs:
11561154
# We also create a couple optional files pinky looks for
11571155
touch /home/runner/.project
11581156
echo "foo" > /home/runner/.plan
1157+
# add user with digital username for testing with issue #7787
1158+
echo 200:x:2000:2000::/home/200:/bin/bash | sudo tee -a /etc/passwd
1159+
echo 200:x:2000: | sudo tee -a /etc/group
11591160
;;
11601161
esac
11611162
@@ -1193,11 +1194,14 @@ jobs:
11931194

11941195
test_separately:
11951196
name: Separate Builds
1196-
runs-on: ${{ matrix.os }}
1197+
runs-on: ${{ matrix.job.os }}
11971198
strategy:
11981199
fail-fast: false
11991200
matrix:
1200-
os: [ubuntu-latest, macos-latest, windows-latest]
1201+
job:
1202+
- { os: ubuntu-latest , features: feat_os_unix }
1203+
- { os: macos-latest , features: feat_os_macos }
1204+
- { os: windows-latest , features: feat_os_windows }
12011205
steps:
12021206
- uses: actions/checkout@v5
12031207
with:
@@ -1207,21 +1211,24 @@ jobs:
12071211
- name: build and test all programs individually
12081212
shell: bash
12091213
run: |
1210-
for f in $(util/show-utils.sh)
1214+
CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ;
1215+
for f in $(util/show-utils.sh ${CARGO_FEATURES_OPTION})
12111216
do
12121217
echo "Building and testing $f"
1213-
cargo test -p "uu_$f" || exit 1
1218+
cargo test -p "uu_$f"
12141219
done
12151220
12161221
test_all_features:
12171222
name: Test all features separately
12181223
needs: [ min_version, deps ]
1219-
runs-on: ${{ matrix.os }}
1224+
runs-on: ${{ matrix.job.os }}
12201225
strategy:
12211226
fail-fast: false
12221227
matrix:
1223-
os: [ubuntu-latest, macos-latest]
1224-
# windows-latest - https://github.com/uutils/coreutils/issues/7044
1228+
job:
1229+
- { os: ubuntu-latest , features: feat_os_unix }
1230+
- { os: macos-latest , features: feat_os_macos }
1231+
# - { os: windows-latest , features: feat_os_windows } https://github.com/uutils/coreutils/issues/7044
12251232
steps:
12261233
- uses: actions/checkout@v5
12271234
with:
@@ -1231,7 +1238,8 @@ jobs:
12311238
- name: build and test all features individually
12321239
shell: bash
12331240
run: |
1234-
for f in $(util/show-utils.sh)
1241+
CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ;
1242+
for f in $(util/show-utils.sh ${CARGO_FEATURES_OPTION})
12351243
do
12361244
echo "Running tests with --features=$f and --no-default-features"
12371245
cargo test --features=$f --no-default-features
@@ -1274,66 +1282,52 @@ jobs:
12741282
- name: Lint with SELinux
12751283
run: lima bash -c "cd work && cargo clippy --all-targets --features 'feat_selinux' -- -D warnings"
12761284

1277-
benchmarks:
1278-
name: Run benchmarks (CodSpeed)
1279-
runs-on: ubuntu-latest
1280-
needs: min_version
1281-
steps:
1282-
- uses: actions/checkout@v5
1283-
with:
1284-
persist-credentials: false
1285-
1286-
- name: Install system dependencies
1287-
shell: bash
1288-
run: |
1289-
sudo apt-get -y update
1290-
sudo apt-get -y install libselinux1-dev
1291-
1292-
- uses: dtolnay/rust-toolchain@stable
1293-
1294-
- uses: Swatinem/rust-cache@v2
1295-
1296-
- name: Run sccache-cache
1297-
uses: mozilla-actions/sccache-action@v0.0.9
1298-
1299-
- name: Install cargo-codspeed
1300-
shell: bash
1301-
run: cargo install cargo-codspeed --locked
1285+
test_selinux_stubs:
1286+
name: Build/SELinux-Stubs (Non-Linux)
1287+
needs: [ min_version, deps ]
1288+
runs-on: ${{ matrix.job.os }}
1289+
strategy:
1290+
fail-fast: false
1291+
matrix:
1292+
job:
1293+
- { os: macos-latest , features: feat_os_macos }
1294+
- { os: windows-latest , features: feat_os_windows }
13021295

1303-
- name: Get benchmark list
1304-
id: benchmark_list
1305-
shell: bash
1306-
run: |
1307-
echo "Finding all utilities with benchmarks..."
1308-
benchmark_packages=""
1309-
for bench_dir in $(ls -d src/uu/*/benches 2>/dev/null); do
1310-
prog_dir=$(dirname "$bench_dir")
1311-
prog_name=$(basename "$prog_dir")
1312-
echo "Found benchmarks for uu_$prog_name"
1313-
benchmark_packages="$benchmark_packages uu_$prog_name"
1314-
done
1315-
echo "benchmark_packages=${benchmark_packages}" >> $GITHUB_OUTPUT
1316-
echo "Found benchmark packages:${benchmark_packages}"
1296+
steps:
1297+
- uses: actions/checkout@v5
1298+
with:
1299+
persist-credentials: false
1300+
- uses: dtolnay/rust-toolchain@stable
1301+
- uses: Swatinem/rust-cache@v2
1302+
- name: Build SELinux utilities as stubs
1303+
run: cargo build -p uu_chcon -p uu_runcon
1304+
- name: Verify stub binaries exist
1305+
shell: bash
1306+
run: |
1307+
if [ "${{ runner.os }}" = "Windows" ]; then
1308+
test -f target/debug/chcon.exe
1309+
test -f target/debug/runcon.exe
1310+
else
1311+
test -f target/debug/chcon
1312+
test -f target/debug/runcon
1313+
fi
1314+
- name: Verify workspace builds with stubs
1315+
run: cargo build --features ${{ matrix.job.features }}
13171316

1318-
- name: Build benchmarks
1319-
shell: bash
1320-
run: |
1321-
echo "Building benchmarks for packages: ${{ steps.benchmark_list.outputs.benchmark_packages }}"
1322-
for package in ${{ steps.benchmark_list.outputs.benchmark_packages }}; do
1323-
echo "Building benchmarks for $package"
1324-
cargo codspeed build -p $package
1325-
done
1317+
test_safe_traversal:
1318+
name: Safe Traversal Security Check
1319+
runs-on: ubuntu-latest
1320+
needs: [ min_version, deps ]
13261321

1327-
- name: Run benchmarks
1328-
uses: CodSpeedHQ/action@v4
1329-
env:
1330-
CODSPEED_LOG: debug
1331-
with:
1332-
mode: instrumentation
1333-
run: |
1334-
echo "Running benchmarks for packages: ${{ steps.benchmark_list.outputs.benchmark_packages }}"
1335-
for package in ${{ steps.benchmark_list.outputs.benchmark_packages }}; do
1336-
echo "Running benchmarks for $package"
1337-
cargo codspeed run -p $package > /dev/null
1338-
done
1339-
token: ${{ secrets.CODSPEED_TOKEN }}
1322+
steps:
1323+
- uses: actions/checkout@v5
1324+
with:
1325+
persist-credentials: false
1326+
- uses: dtolnay/rust-toolchain@stable
1327+
- uses: Swatinem/rust-cache@v2
1328+
- name: Install strace
1329+
run: sudo apt-get update && sudo apt-get install -y strace
1330+
- name: Build utilities with safe traversal
1331+
run: cargo build --release -p uu_rm -p uu_chmod -p uu_chown -p uu_chgrp -p uu_mv -p uu_du
1332+
- name: Run safe traversal verification
1333+
run: ./util/check-safe-traversal.sh

.github/workflows/benchmarks.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Benchmarks
2+
3+
# spell-checker:ignore codspeed dtolnay Swatinem sccache
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- '*'
10+
11+
permissions:
12+
contents: read # to fetch code (actions/checkout)
13+
14+
# End the current execution if there is a new changeset in the PR.
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
18+
19+
jobs:
20+
benchmarks:
21+
name: Run benchmarks (CodSpeed)
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
benchmark-target:
26+
- { package: uu_base64 }
27+
- { package: uu_cp }
28+
- { package: uu_cut }
29+
- { package: uu_du }
30+
- { package: uu_expand }
31+
- { package: uu_fold }
32+
- { package: uu_hashsum }
33+
- { package: uu_ls }
34+
- { package: uu_mv }
35+
- { package: uu_nl }
36+
- { package: uu_numfmt }
37+
- { package: uu_rm }
38+
- { package: uu_seq }
39+
- { package: uu_sort }
40+
- { package: uu_split }
41+
- { package: uu_tsort }
42+
- { package: uu_unexpand }
43+
- { package: uu_uniq }
44+
- { package: uu_wc }
45+
steps:
46+
- uses: actions/checkout@v5
47+
with:
48+
persist-credentials: false
49+
50+
- name: Install system dependencies
51+
shell: bash
52+
run: |
53+
sudo apt-get -y update
54+
sudo apt-get -y install libselinux1-dev
55+
56+
- uses: dtolnay/rust-toolchain@stable
57+
58+
- uses: Swatinem/rust-cache@v2
59+
60+
- name: Run sccache-cache
61+
uses: mozilla-actions/sccache-action@v0.0.9
62+
63+
- name: Install cargo-codspeed
64+
shell: bash
65+
run: cargo install cargo-codspeed --locked
66+
67+
- name: Build benchmarks for ${{ matrix.benchmark-target.package }}
68+
shell: bash
69+
run: |
70+
echo "Building benchmarks for ${{ matrix.benchmark-target.package }}"
71+
cargo codspeed build -p ${{ matrix.benchmark-target.package }}
72+
73+
- name: Run benchmarks for ${{ matrix.benchmark-target.package }}
74+
uses: CodSpeedHQ/action@v4
75+
env:
76+
CODSPEED_LOG: debug
77+
with:
78+
mode: instrumentation
79+
run: |
80+
echo "Running benchmarks for ${{ matrix.benchmark-target.package }}"
81+
cargo codspeed run -p ${{ matrix.benchmark-target.package }} > /dev/null
82+
token: ${{ secrets.CODSPEED_TOKEN }}

.github/workflows/code-quality.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
## Install/setup prerequisites
111111
case '${{ matrix.job.os }}' in
112112
ubuntu-*)
113+
sudo apt-get -y update
113114
# selinux and systemd headers needed to enable all features
114115
sudo apt-get -y install libselinux1-dev libsystemd-dev
115116
;;

0 commit comments

Comments
 (0)