Skip to content

Commit 5e09b83

Browse files
authored
Merge branch 'main' into rm-one-file-system
2 parents 3882f38 + 13c0a81 commit 5e09b83

File tree

369 files changed

+9606
-5172
lines changed

Some content is hidden

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

369 files changed

+9606
-5172
lines changed

.clippy.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
avoid-breaking-exported-api = false
2+
check-private-items = true
13
cognitive-complexity-threshold = 24
24
missing-docs-in-crate-items = true
3-
check-private-items = true

.config/nextest.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@ status-level = "all"
44
final-status-level = "skip"
55
failure-output = "immediate-final"
66
fail-fast = false
7+
8+
[profile.coverage]
9+
retries = 0
10+
status-level = "all"
11+
final-status-level = "skip"
12+
failure-output = "immediate-final"
13+
fail-fast = false

.github/workflows/CICD.yml

Lines changed: 147 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CICD
22

33
# spell-checker:ignore (abbrev/names) CICD CodeCOV MacOS MinGW MSVC musl taiki
44
# spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic Dwarnings RUSTDOCFLAGS RUSTFLAGS Zpanic CARGOFLAGS
5-
# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel
5+
# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel profdata
66
# spell-checker:ignore (people) Peltoche rivy dtolnay Anson dawidd
77
# spell-checker:ignore (shell/tools) binutils choco clippy dmake dpkg esac fakeroot fdesc fdescfs gmake grcov halium lcov libclang libfuse libssl limactl mkdir nextest nocross pacman popd printf pushd redoxer rsync rustc rustfmt rustup shopt sccache utmpdump xargs
88
# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils defconfig DESTDIR gecos getenforce gnueabihf issuecomment maint manpages msys multisize noconfirm nullglob onexitbegin onexitend pell runtest Swatinem tempfile testsuite toybox uutils
@@ -190,12 +190,14 @@ jobs:
190190
unset CARGO_FEATURES_OPTION
191191
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi
192192
outputs CARGO_FEATURES_OPTION
193-
- name: Confirm MinSRV compatible 'Cargo.lock'
193+
- name: Confirm MinSRV compatible '*/Cargo.lock'
194194
shell: bash
195195
run: |
196-
## Confirm MinSRV compatible 'Cargo.lock'
197-
# * 'Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
198-
cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::Incompatible (or out-of-date) 'Cargo.lock' file; update using \`cargo +${{ env.RUST_MIN_SRV }} update\`" ; exit 1 ; }
196+
## Confirm MinSRV compatible '*/Cargo.lock'
197+
# * '*/Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
198+
for dir in "." "fuzz"; do
199+
( cd "$dir" && cargo fetch --locked --quiet ) || { echo "::error file=$dir/Cargo.lock::Incompatible (or out-of-date) '$dir/Cargo.lock' file; update using \`cd '$dir' && cargo +${{ env.RUST_MIN_SRV }} update\`" ; exit 1 ; }
200+
done
199201
- name: Install/setup prerequisites
200202
shell: bash
201203
run: |
@@ -246,7 +248,9 @@ jobs:
246248
run: |
247249
## `cargo update` testing
248250
# * convert any errors/warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
249-
cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::'Cargo.lock' file requires update (use \`cargo +${{ env.RUST_MIN_SRV }} update\`)" ; exit 1 ; }
251+
for dir in "." "fuzz"; do
252+
( cd "$dir" && cargo fetch --locked --quiet ) || { echo "::error file=$dir/Cargo.lock::'$dir/Cargo.lock' file requires update (use \`cd '$dir' && cargo +${{ env.RUST_MIN_SRV }} update\`)" ; exit 1 ; }
253+
done
250254
251255
build_makefile:
252256
name: Build/Makefile
@@ -509,23 +513,25 @@ jobs:
509513
fail-fast: false
510514
matrix:
511515
job:
512-
# - { os , target , cargo-options , features , use-cross , toolchain, skip-tests, workspace-tests }
516+
# - { os , target , cargo-options , default-features, features , use-cross , toolchain, skip-tests, workspace-tests, skip-package, skip-publish }
513517
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , features: feat_os_unix_gnueabihf , use-cross: use-cross , skip-tests: true }
514518
- { os: ubuntu-24.04-arm , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf }
515-
- { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross , skip-tests: true }
519+
- { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross , skip-tests: true }
516520
# - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: feat_selinux , use-cross: use-cross }
517521
- { os: ubuntu-latest , target: i686-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross }
518-
- { os: ubuntu-latest , target: i686-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
522+
- { os: ubuntu-latest , target: i686-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross }
519523
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross }
520524
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,uudoc" , use-cross: no, workspace-tests: true }
521-
- { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
525+
- { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross }
522526
- { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true }
527+
- { os: ubuntu-latest , target: wasm32-unknown-unknown , default-features: false, features: uucore/format, skip-tests: true, skip-package: true, skip-publish: true }
523528
- { os: macos-latest , target: aarch64-apple-darwin , features: feat_os_macos, workspace-tests: true } # M1 CPU
524529
- { os: macos-13 , target: x86_64-apple-darwin , features: feat_os_macos, workspace-tests: true }
525530
- { os: windows-latest , target: i686-pc-windows-msvc , features: feat_os_windows }
526-
- { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows }
531+
# TODO: Re-enable after rust-onig release: https://github.com/rust-onig/rust-onig/issues/193
532+
# - { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows }
527533
- { os: windows-latest , target: x86_64-pc-windows-msvc , features: feat_os_windows }
528-
- { os: windows-latest , target: aarch64-pc-windows-msvc , features: feat_os_windows, use-cross: use-cross , skip-tests: true }
534+
- { os: windows-latest , target: aarch64-pc-windows-msvc , features: feat_os_windows, use-cross: use-cross , skip-tests: true }
529535
steps:
530536
- uses: actions/checkout@v4
531537
with:
@@ -615,6 +621,10 @@ jobs:
615621
CARGO_FEATURES_OPTION='' ;
616622
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ; fi
617623
outputs CARGO_FEATURES_OPTION
624+
# * CARGO_DEFAULT_FEATURES_OPTION
625+
CARGO_DEFAULT_FEATURES_OPTION='' ;
626+
if [ "${{ matrix.job.default-features }}" == "false" ]; then CARGO_DEFAULT_FEATURES_OPTION='--no-default-features' ; fi
627+
outputs CARGO_DEFAULT_FEATURES_OPTION
618628
# * CARGO_CMD
619629
CARGO_CMD='cross'
620630
CARGO_CMD_OPTIONS='+${{ env.RUST_MIN_SRV }}'
@@ -748,20 +758,20 @@ jobs:
748758
# dependencies
749759
echo "## dependency list"
750760
cargo fetch --locked --quiet
751-
cargo tree --locked --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-dedupe -e=no-dev --prefix=none | grep -vE "$PWD" | sort --unique
761+
cargo tree --locked --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }} --no-dedupe -e=no-dev --prefix=none | grep -vE "$PWD" | sort --unique
752762
- name: Build
753763
shell: bash
754764
run: |
755765
## Build
756766
${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} build --release \
757-
--target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
767+
--target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }}
758768
- name: Test
759769
if: matrix.job.skip-tests != true
760770
shell: bash
761771
run: |
762772
## Test
763773
${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} test --target=${{ matrix.job.target }} \
764-
${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
774+
${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }}
765775
env:
766776
RUST_BACKTRACE: "1"
767777
- name: Test individual utilities
@@ -779,6 +789,7 @@ jobs:
779789
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}${{ steps.vars.outputs.ARTIFACTS_SUFFIX }}
780790
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
781791
- name: Package
792+
if: matrix.job.skip-package != true
782793
shell: bash
783794
run: |
784795
## Package artifact(s)
@@ -814,7 +825,7 @@ jobs:
814825
fi
815826
- name: Publish
816827
uses: softprops/action-gh-release@v2
817-
if: steps.vars.outputs.DEPLOY
828+
if: steps.vars.outputs.DEPLOY && matrix.job.skip-publish != true
818829
with:
819830
draft: true
820831
files: |
@@ -997,6 +1008,123 @@ jobs:
9971008
name: toybox-result.json
9981009
path: ${{ steps.vars.outputs.TEST_SUMMARY_FILE }}
9991010

1011+
coverage:
1012+
name: Code Coverage
1013+
runs-on: ${{ matrix.job.os }}
1014+
timeout-minutes: 90
1015+
env:
1016+
SCCACHE_GHA_ENABLED: "true"
1017+
RUSTC_WRAPPER: "sccache"
1018+
strategy:
1019+
fail-fast: false
1020+
matrix:
1021+
job:
1022+
- { os: ubuntu-latest , features: unix, toolchain: nightly }
1023+
# FIXME: Re-enable macos code coverage
1024+
# - { os: macos-latest , features: macos, toolchain: nightly }
1025+
# FIXME: Re-enable Code Coverage on windows, which currently fails due to "profiler_builtins". See #6686.
1026+
# - { os: windows-latest , features: windows, toolchain: nightly-x86_64-pc-windows-gnu }
1027+
steps:
1028+
- uses: actions/checkout@v4
1029+
- uses: dtolnay/rust-toolchain@master
1030+
with:
1031+
toolchain: ${{ matrix.job.toolchain }}
1032+
components: rustfmt
1033+
- uses: taiki-e/install-action@v2
1034+
with:
1035+
tool: nextest,[email protected]
1036+
- uses: Swatinem/rust-cache@v2
1037+
1038+
- name: Run sccache-cache
1039+
uses: mozilla-actions/[email protected]
1040+
1041+
# - name: Reattach HEAD ## may be needed for accurate code coverage info
1042+
# run: git checkout ${{ github.head_ref }}
1043+
1044+
- name: Initialize workflow variables
1045+
id: vars
1046+
shell: bash
1047+
run: |
1048+
## VARs setup
1049+
outputs() { step_id="${{ github.action }}"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo "${var}=${!var}" >> $GITHUB_OUTPUT; done; }
1050+
1051+
# toolchain
1052+
TOOLCHAIN="nightly" ## default to "nightly" toolchain (required for certain required unstable compiler flags) ## !maint: refactor when stable channel has needed support
1053+
1054+
# * specify gnu-type TOOLCHAIN for windows; `grcov` requires gnu-style code coverage data files
1055+
case ${{ matrix.job.os }} in windows-*) TOOLCHAIN="$TOOLCHAIN-x86_64-pc-windows-gnu" ;; esac;
1056+
1057+
# * use requested TOOLCHAIN if specified
1058+
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
1059+
outputs TOOLCHAIN
1060+
1061+
# target-specific options
1062+
1063+
# * CARGO_FEATURES_OPTION
1064+
CARGO_FEATURES_OPTION='--all-features' ; ## default to '--all-features' for code coverage
1065+
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ; fi
1066+
outputs CARGO_FEATURES_OPTION
1067+
1068+
# * CODECOV_FLAGS
1069+
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
1070+
outputs CODECOV_FLAGS
1071+
1072+
- name: Install/setup prerequisites
1073+
shell: bash
1074+
run: |
1075+
## Install/setup prerequisites
1076+
case '${{ matrix.job.os }}' in
1077+
macos-latest) brew install coreutils ;; # needed for testing
1078+
esac
1079+
1080+
case '${{ matrix.job.os }}' in
1081+
ubuntu-latest)
1082+
# pinky is a tool to show logged-in users from utmp, and gecos fields from /etc/passwd.
1083+
# In GitHub Action *nix VMs, no accounts log in, even the "runner" account that runs the commands. The account also has empty gecos fields.
1084+
# To work around this for pinky tests, we create a fake login entry for the GH runner account...
1085+
FAKE_UTMP='[7] [999999] [tty2] [runner] [tty2] [] [0.0.0.0] [2022-02-22T22:22:22,222222+00:00]'
1086+
# ... by dumping the login records, adding our fake line, then reverse dumping ...
1087+
(utmpdump /var/run/utmp ; echo $FAKE_UTMP) | sudo utmpdump -r -o /var/run/utmp
1088+
# ... and add a full name to each account with a gecos field but no full name.
1089+
sudo sed -i 's/:,/:runner name,/' /etc/passwd
1090+
# We also create a couple optional files pinky looks for
1091+
touch /home/runner/.project
1092+
echo "foo" > /home/runner/.plan
1093+
;;
1094+
esac
1095+
1096+
case '${{ matrix.job.os }}' in
1097+
# Update binutils if MinGW due to https://github.com/rust-lang/rust/issues/112368
1098+
windows-latest) C:/msys64/usr/bin/pacman.exe -Sy --needed mingw-w64-x86_64-gcc --noconfirm ; echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH ;;
1099+
esac
1100+
1101+
## Install the llvm-tools component to get access to `llvm-profdata`
1102+
rustup component add llvm-tools
1103+
1104+
- name: Run test and coverage
1105+
id: run_test_cov
1106+
run: |
1107+
outputs() { step_id="${{ github.action }}"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo "${var}=${!var}" >> $GITHUB_OUTPUT; done; }
1108+
1109+
# Run the coverage script
1110+
./util/build-run-test-coverage-linux.sh
1111+
1112+
outputs REPORT_FILE
1113+
env:
1114+
COVERAGE_DIR: ${{ github.workspace }}/coverage
1115+
FEATURES_OPTION: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
1116+
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
1117+
1118+
- name: Upload coverage results (to Codecov.io)
1119+
uses: codecov/codecov-action@v5
1120+
with:
1121+
token: ${{ secrets.CODECOV_TOKEN }}
1122+
file: ${{ steps.run_test_cov.outputs.report }}
1123+
## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }}
1124+
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
1125+
name: codecov-umbrella
1126+
fail_ci_if_error: false
1127+
10001128
test_separately:
10011129
name: Separate Builds
10021130
runs-on: ${{ matrix.os }}
@@ -1067,7 +1195,7 @@ jobs:
10671195
- run: rsync -v -a -e ssh . lima-default:~/work/
10681196
- name: Setup Rust and other build deps in VM
10691197
run: |
1070-
lima sudo dnf install gcc g++ git rustup libselinux-devel clang-devel -y
1198+
lima sudo dnf install gcc g++ git rustup libselinux-devel clang-devel attr -y
10711199
lima rustup-init -y --default-toolchain stable
10721200
- name: Verify SELinux Status
10731201
run: |
@@ -1077,3 +1205,5 @@ jobs:
10771205
run: |
10781206
lima ls
10791207
lima bash -c "cd work && cargo test --features 'feat_selinux'"
1208+
- name: Lint with SELinux
1209+
run: lima bash -c "cd work && cargo clippy --all-targets --features 'feat_selinux' -- -D warnings"

.github/workflows/FixPR.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ jobs:
4343
- name: Ensure updated 'Cargo.lock'
4444
shell: bash
4545
run: |
46-
# Ensure updated 'Cargo.lock'
47-
# * 'Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
48-
cargo fetch --locked --quiet || cargo +${{ steps.vars.outputs.RUST_MIN_SRV }} update
46+
# Ensure updated '*/Cargo.lock'
47+
# * '*/Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
48+
for dir in "." "fuzz"; do
49+
( cd "$dir" && (cargo fetch --locked --quiet || cargo +${{ steps.vars.outputs.RUST_MIN_SRV }} update) )
50+
done
4951
- name: Info
5052
shell: bash
5153
run: |
@@ -71,8 +73,8 @@ jobs:
7173
with:
7274
new_branch: ${{ env.BRANCH_TARGET }}
7375
default_author: github_actions
74-
message: "maint ~ refresh 'Cargo.lock'"
75-
add: Cargo.lock
76+
message: "maint ~ refresh 'Cargo.lock' 'fuzz/Cargo.lock'"
77+
add: Cargo.lock fuzz/Cargo.lock
7678
env:
7779
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7880

.github/workflows/GnuTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
outputs path_GNU path_GNU_tests path_reference path_UUTILS
5050
#
5151
repo_default_branch="$DEFAULT_BRANCH"
52-
repo_GNU_ref="v9.6"
52+
repo_GNU_ref="v9.7"
5353
repo_reference_branch="$DEFAULT_BRANCH"
5454
outputs repo_default_branch repo_GNU_ref repo_reference_branch
5555
#

.github/workflows/code-quality.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,10 @@ jobs:
109109
command: |
110110
## `cargo clippy` lint testing
111111
unset fault
112-
CLIPPY_FLAGS="-W clippy::default_trait_access -W clippy::manual_string_new -W clippy::cognitive_complexity -W clippy::implicit_clone -W clippy::range-plus-one -W clippy::redundant-clone -W clippy::match_bool"
113112
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
114113
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
115114
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
116-
S=$(cargo clippy --all-targets --features ${{ matrix.job.features }} --tests -pcoreutils -- ${CLIPPY_FLAGS} -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; }
115+
S=$(cargo clippy --all-targets --features ${{ matrix.job.features }} --tests -pcoreutils -- -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; }
117116
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
118117
119118
style_spellcheck:

0 commit comments

Comments
 (0)