1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Merge pull request #2750 from rivy/fix.cicd

Fix/enhance CICD
This commit is contained in:
Sylvestre Ledru 2021-11-20 14:43:37 +01:00 committed by GitHub
commit 4d33a3af64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
205 changed files with 35296 additions and 302 deletions

View file

@ -2,10 +2,10 @@ name: CICD
# spell-checker:ignore (acronyms) CICD MSVC musl
# spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic RUSTDOCFLAGS RUSTFLAGS Zpanic
# spell-checker:ignore (jargon) SHAs deps softprops toolchain
# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain
# spell-checker:ignore (names) CodeCOV MacOS MinGW Peltoche rivy
# spell-checker:ignore (shell/tools) choco clippy dmake dpkg esac fakeroot gmake grcov halium lcov libssl mkdir popd printf pushd rustc rustfmt rustup shopt xargs
# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils gnueabihf issuecomment maint nullglob onexitbegin onexitend runtest tempfile testsuite uutils
# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils gnueabihf issuecomment maint nullglob onexitbegin onexitend pell runtest tempfile testsuite uutils
# ToDO: [2021-06; rivy] change from `cargo-tree` to `cargo tree` once MSRV is >= 1.45
@ -14,18 +14,27 @@ env:
PROJECT_DESC: "Core universal (cross-platform) utilities"
PROJECT_AUTH: "uutils"
RUST_MIN_SRV: "1.47.0" ## MSRV v1.47.0
# * style job configuration
STYLE_FAIL_ON_FAULT: true ## (bool) fail the build if a style job contains a fault (error or warning); may be overridden on a per-job basis
on: [push, pull_request]
jobs:
code_deps:
name: Style/dependencies
style_deps:
## ToDO: [2021-11-10; rivy] 'Style/deps' needs more informative output and better integration of results into the GHA dashboard
name: Style/deps
runs-on: ${{ matrix.job.os }}
# env:
# STYLE_FAIL_ON_FAULT: false # overrides workflow default
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest , features: feat_os_unix }
# note: `cargo-udeps` panics when processing stdbuf/libstdbuf ("uu_stdbuf_libstdbuf"); either b/c of the 'cpp' crate or 'libstdbuf' itself
# ... b/c of the panic, a more limited feature set is tested (though only excluding `stdbuf`)
- { os: ubuntu-latest , features: "feat_Tier1,feat_require_unix,feat_require_unix_utmpx" }
- { os: macos-latest , features: "feat_Tier1,feat_require_unix,feat_require_unix_utmpx" }
- { os: windows-latest , features: feat_os_windows }
steps:
- uses: actions/checkout@v2
- name: Initialize workflow variables
@ -34,27 +43,50 @@ jobs:
run: |
## VARs setup
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# failure mode
unset FAIL_ON_FAULT ; case '${{ env.STYLE_FAIL_ON_FAULT }}' in
''|0|f|false|n|no|off) FAULT_TYPE=warning ;;
*) FAIL_ON_FAULT=true ; FAULT_TYPE=error ;;
esac;
outputs FAIL_ON_FAULT FAULT_TYPE
# target-specific options
# * CARGO_FEATURES_OPTION
CARGO_FEATURES_OPTION='' ;
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi
outputs CARGO_FEATURES_OPTION
## note: requires 'nightly' toolchain b/c `cargo-udeps` uses the `rustc` '-Z save-analysis' option
## * ... ref: <https://github.com/est31/cargo-udeps/issues/73>
- name: Install `rust` toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
default: true
profile: minimal # minimal component installation (ie, no documentation)
- name: "`cargo update` testing"
profile: minimal
- name: Install `cargo-udeps`
uses: actions-rs/install@v0.1
with:
crate: cargo-udeps
version: latest
use-tool-cache: false
env:
RUSTUP_TOOLCHAIN: stable
- name: Detect unused dependencies
shell: bash
run: |
## `cargo update` testing
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::'Cargo.lock' file requires update (use \`cargo +${{ env.RUST_MIN_SRV }} update\`)" ; exit 1 ; }
## Detect unused dependencies
unset fault
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
#
cargo +nightly udeps ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --all-targets &> udeps.log || cat udeps.log
grep --ignore-case "all deps seem to have been used" udeps.log || { printf "%s\n" "::${fault_type} ::${fault_prefix}: \`cargo udeps\`: style violation (unused dependency found)" ; fault=true ; }
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
code_format:
style_format:
name: Style/format
runs-on: ${{ matrix.job.os }}
# env:
# STYLE_FAIL_ON_FAULT: false # overrides workflow default
strategy:
fail-fast: false
matrix:
@ -68,6 +100,12 @@ jobs:
run: |
## VARs setup
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# failure mode
unset FAIL_ON_FAULT ; case '${{ env.STYLE_FAIL_ON_FAULT }}' in
''|0|f|false|n|no|off) FAULT_TYPE=warning ;;
*) FAIL_ON_FAULT=true ; FAULT_TYPE=error ;;
esac;
outputs FAIL_ON_FAULT FAULT_TYPE
# target-specific options
# * CARGO_FEATURES_OPTION
CARGO_FEATURES_OPTION='' ;
@ -80,38 +118,147 @@ jobs:
default: true
profile: minimal # minimal component installation (ie, no documentation)
components: rustfmt
- name: "`fmt` testing"
- name: "`cargo fmt` testing"
shell: bash
run: |
## `fmt` testing
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
S=$(cargo fmt -- --check) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s\n" "$S" | sed -E -n -e "s/^Diff[[:space:]]+in[[:space:]]+${PWD//\//\\/}\/(.*)[[:space:]]+at[[:space:]]+[^0-9]+([0-9]+).*$/::error file=\1,line=\2::ERROR: \`cargo fmt\`: style violation (file:'\1', line:\2; use \`cargo fmt \"\1\"\`)/p" ; exit 1 ; }
- name: "`fmt` testing of tests"
## `cargo fmt` testing
unset fault
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
# * 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>
S=$(cargo fmt -- --check) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s\n" "$S" | sed -E -n -e "s/^Diff[[:space:]]+in[[:space:]]+${PWD//\//\\/}\/(.*)[[:space:]]+at[[:space:]]+[^0-9]+([0-9]+).*$/::${fault_type} file=\1,line=\2::${fault_prefix}: \`cargo fmt\`: style violation (file:'\1', line:\2; use \`cargo fmt -- \"\1\"\`)/p" ; fault=true ; }
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
- name: "`cargo fmt` testing of integration tests"
if: success() || failure() # run regardless of prior step success/failure
shell: bash
run: |
## `fmt` testing of tests
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
S=$(find tests -name "*.rs" -print0 | xargs -0 cargo fmt -- --check) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s\n" "$S" | sed -E -n "s/^Diff[[:space:]]+in[[:space:]]+${PWD//\//\\/}\/(.*)[[:space:]]+at[[:space:]]+[^0-9]+([0-9]+).*$/::error file=\1,line=\2::ERROR: \`cargo fmt\`: style violation (file:'\1', line:\2; use \`cargo fmt \"\1\"\`)/p" ; exit 1 ; }
## `cargo fmt` testing of integration tests
unset fault
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
# 'tests' is the standard/usual integration test directory
if [ -d tests ]; then
# * 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>
S=$(find tests -name "*.rs" -print0 | xargs -0 cargo fmt -- --check) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s\n" "$S" | sed -E -n "s/^Diff[[:space:]]+in[[:space:]]+${PWD//\//\\/}\/(.*)[[:space:]]+at[[:space:]]+[^0-9]+([0-9]+).*$/::${fault_type} file=\1,line=\2::${fault_prefix}: \`cargo fmt\`: style violation (file:'\1', line:\2; use \`cargo fmt \"\1\"\`)/p" ; fault=true ; }
fi
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
code_lint:
style_lint:
name: Style/lint
runs-on: ${{ matrix.job.os }}
# env:
# STYLE_FAIL_ON_FAULT: false # overrides workflow default
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest }
- { 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@v2
- name: Initialize workflow variables
id: vars
shell: bash
run: |
## VARs setup
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# failure mode
unset FAIL_ON_FAULT ; case '${{ env.STYLE_FAIL_ON_FAULT }}' in
''|0|f|false|n|no|off) FAULT_TYPE=warning ;;
*) FAIL_ON_FAULT=true ; FAULT_TYPE=error ;;
esac;
outputs FAIL_ON_FAULT FAULT_TYPE
# target-specific options
# * CARGO_FEATURES_OPTION
CARGO_FEATURES_OPTION='--all-features' ;
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi
outputs CARGO_FEATURES_OPTION
# * determine sub-crate utility list
UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})"
echo UTILITY_LIST=${UTILITY_LIST}
CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)"
outputs CARGO_UTILITY_LIST_OPTIONS
- name: Install/setup prerequisites
shell: bash
run: |
case '${{ matrix.job.os }}' in
macos-latest) brew install coreutils ;; # needed for show-utils.sh
esac
- name: Install `rust` toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal # minimal component installation (ie, no documentation)
components: clippy
- name: "`cargo clippy` lint testing"
shell: bash
run: |
## `cargo clippy` lint testing
unset fault
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
S=$(cargo clippy --all-targets ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_UTILITY_LIST_OPTIONS }} -- -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 ; }
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
style_spellcheck:
name: Style/spelling
runs-on: ${{ matrix.job.os }}
# env:
# STYLE_FAIL_ON_FAULT: false # overrides workflow default
strategy:
matrix:
job:
- { os: ubuntu-latest , features: feat_os_unix }
steps:
- uses: actions/checkout@v2
- name: Initialize workflow variables
id: vars
shell: bash
run: |
## VARs setup
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# failure mode
unset FAIL_ON_FAULT ; case '${{ env.STYLE_FAIL_ON_FAULT }}' in
''|0|f|false|n|no|off) FAULT_TYPE=warning ;;
*) FAIL_ON_FAULT=true ; FAULT_TYPE=error ;;
esac;
outputs FAIL_ON_FAULT FAULT_TYPE
- name: Install/setup prerequisites
shell: bash
run: |
## Install/setup prerequisites
# * pin installed cspell to v4.2.8 (cspell v5+ is broken for NodeJS < v12)
## maint: [2021-11-10; rivy] `cspell` version may be advanced to v5 when used with NodeJS >= v12
sudo apt-get -y update ; sudo apt-get -y install npm ; sudo npm install cspell@4.2.8 -g ;
- name: Run `cspell`
shell: bash
run: |
## Run `cspell`
unset fault
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
# * find cspell configuration ; note: avoid quotes around ${cfg_file} b/c `cspell` (v4) doesn't correctly dequote the config argument (or perhaps a subshell expansion issue?)
cfg_files=($(shopt -s nullglob ; echo {.vscode,.}/{,.}c[sS]pell{.json,.config{.js,.cjs,.json,.yaml,.yml},.yaml,.yml} ;))
cfg_file=${cfg_files[0]}
unset CSPELL_CFG_OPTION ; if [ -n "$cfg_file" ]; then CSPELL_CFG_OPTION="--config $cfg_file" ; fi
# * `cspell`
## maint: [2021-11-10; rivy] the `--no-progress` option for `cspell` is a `cspell` v5+ option
# S=$(cspell ${CSPELL_CFG_OPTION} --no-summary --no-progress "**/*") && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n "s/${PWD//\//\\/}\/(.*):(.*):(.*) - (.*)/::${fault_type} file=\1,line=\2,col=\3::${fault_type^^}: \4 (file:'\1', line:\2)/p" ; fault=true ; true ; }
S=$(cspell ${CSPELL_CFG_OPTION} --no-summary "**/*") && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n "s/${PWD//\//\\/}\/(.*):(.*):(.*) - (.*)/::${fault_type} file=\1,line=\2,col=\3::${fault_type^^}: \4 (file:'\1', line:\2)/p" ; fault=true ; true ; }
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
min_version:
name: MinRustV # Minimum supported rust version (aka, MinSRV or MSRV)
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
job:
- { os: ubuntu-latest , features: feat_os_unix }
steps:
- uses: actions/checkout@v2
- name: Initialize workflow variables
id: vars
shell: bash
@ -120,57 +267,9 @@ jobs:
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# target-specific options
# * CARGO_FEATURES_OPTION
CARGO_FEATURES_OPTION='--all-features' ;
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features ${{ matrix.job.features }}' ; fi
unset CARGO_FEATURES_OPTION
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi
outputs CARGO_FEATURES_OPTION
# * determine sub-crate utility list
UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})"
echo UTILITY_LIST=${UTILITY_LIST}
CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)"
outputs CARGO_UTILITY_LIST_OPTIONS
- name: Install `rust` toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
profile: minimal # minimal component installation (ie, no documentation)
components: clippy
- name: "`clippy` lint testing"
shell: bash
run: |
## `clippy` lint testing
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
S=$(cargo +nightly clippy --all-targets ${{ steps.vars.outputs.CARGO_UTILITY_LIST_OPTIONS }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -- -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:]]+${PWD//\//\\/}\/(.*):([0-9]+):([0-9]+).*$/::error file=\2,line=\3,col=\4::ERROR: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; exit 1 ; }
code_spellcheck:
name: Style/spelling
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
job:
- { os: ubuntu-latest }
steps:
- uses: actions/checkout@v2
- name: Install/setup prerequisites
shell: bash
run: |
## Install/setup prerequisites
sudo apt-get -y update ; sudo apt-get -y install npm ; sudo npm install cspell -g ;
- name: Run `cspell`
shell: bash
run: |
## Run `cspell`
cspell --config .vscode/cSpell.json --no-summary --no-progress "**/*" | sed -E -n "s/${PWD//\//\\/}\/(.*):(.*):(.*) - (.*)/::error file=\1,line=\2,col=\3::ERROR: \4 (file:'\1', line:\2)/p"
min_version:
name: MinRustV # Minimum supported rust version
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
job:
- { os: ubuntu-latest , features: feat_os_unix }
steps:
- uses: actions/checkout@v2
- name: Install `rust` toolchain (v${{ env.RUST_MIN_SRV }})
uses: actions-rs/toolchain@v1
with:
@ -208,25 +307,25 @@ jobs:
cargo-tree tree -V
# dependencies
echo "## dependency list"
cargo fetch --locked --quiet
## * using the 'stable' toolchain is necessary to avoid "unexpected '--filter-platform'" errors
RUSTUP_TOOLCHAIN=stable cargo-tree tree --locked --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique
RUSTUP_TOOLCHAIN=stable cargo fetch --locked --quiet
RUSTUP_TOOLCHAIN=stable cargo-tree tree --all --locked --no-dev-dependencies --no-indent ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} | grep -vE "$PWD" | sort --unique
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --features "feat_os_unix" -p uucore -p coreutils
args: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -p uucore -p coreutils
env:
RUSTFLAGS: '-Awarnings'
RUSTFLAGS: "-Awarnings"
build_makefile:
name: Build/Makefile
deps:
name: Dependencies
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest }
- { os: ubuntu-latest , features: feat_os_unix }
steps:
- uses: actions/checkout@v2
- name: Install `rust` toolchain
@ -235,11 +334,35 @@ jobs:
toolchain: stable
default: true
profile: minimal # minimal component installation (ie, no documentation)
- name: "`cargo update` testing"
shell: bash
run: |
## `cargo update` testing
# * 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>
cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::'Cargo.lock' file requires update (use \`cargo +${{ env.RUST_MIN_SRV }} update\`)" ; exit 1 ; }
build_makefile:
name: Build/Makefile
needs: [ min_version, deps ]
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest , features: feat_os_unix }
steps:
- uses: actions/checkout@v2
- name: Install/setup prerequisites
shell: bash
run: |
## Install/setup prerequisites
sudo apt-get -y update ; sudo apt-get -y install python3-sphinx ;
- name: Install `rust` toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal # minimal component installation (ie, no documentation)
- name: "`make build`"
shell: bash
run: |
@ -251,13 +374,14 @@ jobs:
build:
name: Build
needs: [ min_version, deps ]
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
# { os, target, cargo-options, features, use-cross, toolchain }
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , features: feat_os_unix_gnueabihf , use-cross: use-cross }
# { os , target , cargo-options , features , use-cross , toolchain }
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf, features: feat_os_unix_gnueabihf, use-cross: use-cross, }
- { os: ubuntu-latest , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf , use-cross: use-cross }
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: feat_os_unix , use-cross: use-cross }
# - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: feat_selinux , use-cross: use-cross }
@ -270,21 +394,10 @@ jobs:
- { os: macos-latest , target: x86_64-apple-darwin , features: feat_os_macos }
- { os: windows-latest , target: i686-pc-windows-gnu , features: feat_os_windows }
- { os: windows-latest , target: i686-pc-windows-msvc , features: feat_os_windows }
- { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows } ## note: requires rust >= 1.43.0 to link correctly
- { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows } ## note: requires rust >= 1.43.0 to link correctly
- { os: windows-latest , target: x86_64-pc-windows-msvc , features: feat_os_windows }
steps:
- uses: actions/checkout@v2
- name: Install/setup prerequisites
shell: bash
run: |
## Install/setup prerequisites
case '${{ matrix.job.target }}' in
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
esac
case '${{ matrix.job.os }}' in
macos-latest) brew install coreutils ;; # needed for testing
esac
- name: Initialize workflow variables
id: vars
shell: bash
@ -373,6 +486,17 @@ jobs:
*-pc-windows-msvc) STRIP="" ;;
esac;
outputs STRIP
- name: Install/setup prerequisites
shell: bash
run: |
## Install/setup prerequisites
case '${{ matrix.job.target }}' in
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
esac
case '${{ matrix.job.os }}' in
macos-latest) brew install coreutils ;; # needed for testing
esac
- name: Create all needed build/work directories
shell: bash
run: |
@ -380,12 +504,23 @@ jobs:
mkdir -p '${{ steps.vars.outputs.STAGING }}'
mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}'
mkdir -p '${{ steps.vars.outputs.STAGING }}/dpkg'
- name: Install/setup prerequisites
shell: bash
run: |
## Install/setup prerequisites
case '${{ matrix.job.target }}' in
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
esac
case '${{ matrix.job.os }}' in
macos-latest) brew install coreutils ;; # needed for testing
esac
- name: rust toolchain ~ install
uses: actions-rs/toolchain@v1
env:
# Override auto-detection of RAM for Rustc install.
# https://github.com/rust-lang/rustup/issues/2229#issuecomment-585855925
RUSTUP_UNPACK_RAM: "21474836480"
# env:
# # Override auto-detection of RAM for Rustc install.
# # https://github.com/rust-lang/rustup/issues/2229#issuecomment-585855925
# RUSTUP_UNPACK_RAM: "21474836480"
with:
toolchain: ${{ steps.vars.outputs.TOOLCHAIN }}
target: ${{ matrix.job.target }}
@ -502,6 +637,7 @@ jobs:
test_busybox:
name: Tests/BusyBox test suite
needs: [ min_version, deps ]
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
@ -510,16 +646,17 @@ jobs:
- { os: ubuntu-latest }
steps:
- uses: actions/checkout@v2
- name: Install/setup prerequisites
shell: bash
run: |
## Install/setup prerequisites
make prepare-busytest
- name: Install `rust` toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal # minimal component installation (ie, no documentation)
- name: Install/setup prerequisites
shell: bash
run: |
make prepare-busytest
- name: "Run BusyBox test suite"
shell: bash
run: |
@ -532,53 +669,75 @@ jobs:
if [ $n_fails -gt 0 ] ; then echo "::warning ::${n_fails}+ test failures" ; fi
test_freebsd:
runs-on: macos-10.15
name: Tests/FreeBSD test suite
needs: [ min_version, deps ]
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { os: macos-10.15 , features: unix } ## GHA MacOS-11.0 VM won't have VirtualBox; refs: <https://github.com/actions/virtual-environments/issues/4060> , <https://github.com/actions/virtual-environments/pull/4010>
env:
mem: 2048
steps:
- uses: actions/checkout@v2
- name: Prepare, build and test
id: test
## spell-checker:ignore (ToDO) sshfs usesh vmactions
uses: vmactions/freebsd-vm@v0.1.5
with:
usesh: true
# sync: sshfs
prepare: pkg install -y curl gmake sudo
run: |
# Need to be run in the same block. Otherwise, we are back on the mac host.
## Prepare, build, and test
# implementation modelled after ref: <https://github.com/rust-lang/rustup/pull/2783>
# * NOTE: All steps need to be run in this block, otherwise, we are operating back on the mac host
set -e
pw adduser -n cuuser -d /root/ -g wheel -c "Coreutils user to build" -w random
chown -R cuuser:wheel /root/ /Users/runner/work/coreutils/
#
TEST_USER=tester
REPO_NAME=${GITHUB_WORKSPACE##*/}
WORKSPACE_PARENT="/Users/runner/work/${REPO_NAME}"
WORKSPACE="${WORKSPACE_PARENT}/${REPO_NAME}"
#
pw adduser -n ${TEST_USER} -d /root/ -g wheel -c "Coreutils user to build" -w random
# chown -R ${TEST_USER}:wheel /root/ "${WORKSPACE_PARENT}"/
chown -R ${TEST_USER}:wheel /root/ "/Users/runner/work/${REPO_NAME}"/
whoami
# Needs to be done in a sudo as we are changing users
sudo -i -u cuuser sh << EOF
#
# Further work needs to be done in a sudo as we are changing users
sudo -i -u ${TEST_USER} sh << EOF
set -e
whoami
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile=minimal
. $HOME/.cargo/env
## Info
# environment
echo "## environment"
echo "CI='${CI}'"
# tooling info display
echo "## tooling"
. $HOME/.cargo/env
echo "REPO_NAME='${REPO_NAME}'"
echo "TEST_USER='${TEST_USER}'"
echo "WORKSPACE_PARENT='${WORKSPACE_PARENT}'"
echo "WORKSPACE='${WORKSPACE}'"
env | sort
# tooling info
echo "## tooling info"
cargo -V
rustc -V
env
# where the files are resynced
cd /Users/runner/work/coreutils/coreutils/
cargo build
cargo test --features feat_os_unix -p uucore -p coreutils
#
cd "${WORKSPACE}"
unset FAULT
cargo build || FAULT=1
cargo test --features "${{ matrix.job.features }}" || FAULT=1
cargo test --features "${{ matrix.job.features }}" -p uucore || FAULT=1
# Clean to avoid to rsync back the files
cargo clean
if (test -n "$FAULT"); then exit 1 ; fi
EOF
coverage:
name: Code Coverage
needs: build
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: true
@ -590,13 +749,6 @@ jobs:
- { os: windows-latest , features: windows }
steps:
- uses: actions/checkout@v2
- name: Install/setup prerequisites
shell: bash
run: |
## Install/setup prerequisites
case '${{ matrix.job.os }}' in
macos-latest) brew install coreutils ;; # needed for testing
esac
# - name: Reattach HEAD ## may be needed for accurate code coverage info
# run: git checkout ${{ github.head_ref }}
- name: Initialize workflow variables
@ -623,6 +775,13 @@ jobs:
# * CODECOV_FLAGS
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
outputs CODECOV_FLAGS
- name: Install/setup prerequisites
shell: bash
run: |
## Install/setup prerequisites
case '${{ matrix.job.os }}' in
macos-latest) brew install coreutils ;; # needed for testing
esac
- name: rust toolchain ~ install
uses: actions-rs/toolchain@v1
with:
@ -645,10 +804,10 @@ jobs:
command: test
args: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-fail-fast -p uucore
env:
CARGO_INCREMENTAL: '0'
RUSTC_WRAPPER: ''
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort'
RUSTDOCFLAGS: '-Cpanic=abort'
CARGO_INCREMENTAL: "0"
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
- name: Test
uses: actions-rs/cargo@v1
@ -656,10 +815,10 @@ jobs:
command: test
args: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTC_WRAPPER: ''
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort'
RUSTDOCFLAGS: '-Cpanic=abort'
CARGO_INCREMENTAL: "0"
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
- name: Test individual utilities
uses: actions-rs/cargo@v1
@ -667,10 +826,10 @@ jobs:
command: test
args: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-fail-fast ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
env:
CARGO_INCREMENTAL: '0'
RUSTC_WRAPPER: ''
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort'
RUSTDOCFLAGS: '-Cpanic=abort'
CARGO_INCREMENTAL: "0"
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
- name: "`grcov` ~ install"
uses: actions-rs/install@v0.1
@ -703,35 +862,3 @@ jobs:
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
name: codecov-umbrella
fail_ci_if_error: false
unused_deps:
name: Unused deps
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
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@v2
- name: Install `rust` toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
profile: minimal
- name: Install `cargo-udeps`
uses: actions-rs/install@v0.1
with:
crate: cargo-udeps
version: latest
use-tool-cache: true
env:
RUSTUP_TOOLCHAIN: stable
- name: Confirms there isn't any unused deps
shell: bash
run: |
cargo +nightly udeps --all-targets &> udeps.log || cat udeps.log
grep "seem to have been used" udeps.log

2
.vscode/cSpell.json vendored
View file

@ -11,7 +11,7 @@
{ "name": "workspace", "path": "./cspell.dictionaries/workspace.wordlist.txt" }
],
// ignorePaths - a list of globs to specify which files are to be ignored
"ignorePaths": ["Cargo.lock", "target/**", "tests/**/fixtures/**", "src/uu/dd/test-resources/**"],
"ignorePaths": ["Cargo.lock", "target/**", "tests/**/fixtures/**", "src/uu/dd/test-resources/**", "vendor/**"],
// ignoreWords - a list of words to be ignored (even if they are in the flagWords)
"ignoreWords": [],
// words - list of words to be always considered correct

58
Cargo.lock generated
View file

@ -1,7 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "Inflector"
version = "0.11.4"
@ -213,9 +211,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cc"
version = "1.0.71"
version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd"
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
[[package]]
name = "cexpr"
@ -320,7 +318,7 @@ dependencies = [
"glob",
"lazy_static",
"libc",
"nix 0.20.0",
"nix 0.23.1",
"pretty_assertions",
"rand 0.7.3",
"regex",
@ -625,7 +623,7 @@ version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19c6cedffdc8c03a3346d723eb20bd85a13362bb96dc2ac000842c6381ec7bf"
dependencies = [
"nix 0.23.0",
"nix 0.23.1",
"winapi 0.3.9",
]
@ -1007,9 +1005,9 @@ checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
[[package]]
name = "libloading"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0cf036d15402bea3c5d4de17b3fce76b3e4a56ebc1f577be0e7a72f7c607cf0"
checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52"
dependencies = [
"cfg-if 1.0.0",
"winapi 0.3.9",
@ -1109,30 +1107,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "nix"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
]
[[package]]
name = "nix"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
]
[[package]]
name = "nix"
version = "0.21.0"
@ -1148,9 +1122,7 @@ dependencies = [
[[package]]
name = "nix"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188"
version = "0.23.1"
dependencies = [
"bitflags",
"cc",
@ -2216,7 +2188,7 @@ version = "0.0.8"
dependencies = [
"atty",
"clap",
"nix 0.20.0",
"nix 0.23.1",
"thiserror",
"unix_socket",
"uucore",
@ -2691,7 +2663,7 @@ dependencies = [
"atty",
"clap",
"crossterm",
"nix 0.19.1",
"nix 0.23.1",
"redox_syscall",
"redox_termios",
"unicode-segmentation",
@ -2716,7 +2688,7 @@ version = "0.0.8"
dependencies = [
"clap",
"libc",
"nix 0.20.0",
"nix 0.23.1",
"uucore",
"uucore_procs",
]
@ -3065,7 +3037,7 @@ version = "0.0.8"
dependencies = [
"clap",
"libc",
"nix 0.20.0",
"nix 0.23.1",
"redox_syscall",
"uucore",
"uucore_procs",
@ -3100,7 +3072,7 @@ version = "0.0.8"
dependencies = [
"clap",
"libc",
"nix 0.20.0",
"nix 0.23.1",
"uucore",
"uucore_procs",
]
@ -3231,7 +3203,7 @@ dependencies = [
"bytecount",
"clap",
"libc",
"nix 0.20.0",
"nix 0.23.1",
"unicode-width",
"utf-8",
"uucore",
@ -3263,7 +3235,7 @@ name = "uu_yes"
version = "0.0.8"
dependencies = [
"clap",
"nix 0.20.0",
"nix 0.23.1",
"uucore",
"uucore_procs",
]
@ -3280,7 +3252,7 @@ dependencies = [
"getopts",
"lazy_static",
"libc",
"nix 0.20.0",
"nix 0.23.1",
"once_cell",
"os_display",
"termion",

View file

@ -381,12 +381,15 @@ atty = "0.2"
rlimit = "0.4.0"
[target.'cfg(unix)'.dev-dependencies]
nix = "0.20.0"
nix = "=0.23.1"
rust-users = { version="0.10", package="users" }
unix_socket = "0.5.0"
[[bin]]
name = "coreutils"
path = "src/bin/coreutils.rs"
[patch.crates-io]
# FixME: [2021-11-16; rivy] remove 'nix' patch when MacOS compatibility is restored; ref: <https://github.com/nix-rust/nix/pull/1590>
# nix = { git = "https://github.com/rivy-t/nix" }
nix = { path = "vendor/nix-v0.23.1-patched" }

View file

@ -23,3 +23,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "arch"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "base32"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "base64"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "basename"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "basenc"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -23,7 +23,7 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[target.'cfg(unix)'.dependencies]
unix_socket = "0.5.0"
nix = "0.20.0"
nix = "=0.23.1"
[target.'cfg(windows)'.dependencies]
winapi-util = "0.1.5"
@ -31,3 +31,6 @@ winapi-util = "0.1.5"
[[bin]]
name = "cat"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -25,3 +25,6 @@ libc = { version = "0.2" }
[[bin]]
name = "chcon"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -707,7 +707,7 @@ fn root_dev_ino_warn(dir_name: &Path) {
// When a program like chgrp performs a recursive traversal that requires traversing symbolic links,
// it is *not* a problem.
// However, when invoked with "-P -R", it deserves a warning.
// The fts_options parameter records the options that control this aspect of fts's behavior,
// The fts_options parameter records the options that control this aspect of fts behavior,
// so test that.
fn cycle_warning_required(fts_options: c_int, entry: &fts::EntryRef) -> bool {
// When dereferencing no symlinks, or when dereferencing only those listed on the command line

View file

@ -22,3 +22,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "chgrp"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -24,3 +24,6 @@ walkdir = "2.2"
[[bin]]
name = "chmod"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -22,3 +22,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "chown"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -22,3 +22,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "chroot"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "cksum"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "comm"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -47,5 +47,4 @@ feat_selinux = ["selinux"]
feat_acl = ["exacl"]
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -26,5 +26,4 @@ name = "csplit"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -27,5 +27,4 @@ name = "cut"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -31,5 +31,4 @@ name = "date"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -33,5 +33,4 @@ name = "dd"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -20,7 +20,7 @@ pub enum ParseError {
MultipleFmtTable,
MultipleUCaseLCase,
MultipleBlockUnblock,
MultipleExclNoCreat,
MultipleExclNoCreate,
FlagNoMatch(String),
ConvFlagNoMatch(String),
MultiplierStringParseFailure(String),
@ -45,7 +45,7 @@ impl std::fmt::Display for ParseError {
Self::MultipleBlockUnblock => {
write!(f, "Only one of conv=block or conv=unblock may be specified")
}
Self::MultipleExclNoCreat => {
Self::MultipleExclNoCreate => {
write!(f, "Only one ov conv=excl or conv=nocreat may be specified")
}
Self::FlagNoMatch(arg) => {
@ -523,14 +523,14 @@ pub fn parse_conv_flag_output(matches: &Matches) -> Result<OConvFlags, ParseErro
if !oconvflags.nocreat {
oconvflags.excl = true;
} else {
return Err(ParseError::MultipleExclNoCreat);
return Err(ParseError::MultipleExclNoCreate);
}
}
ConvFlag::NoCreat => {
if !oconvflags.excl {
oconvflags.nocreat = true;
} else {
return Err(ParseError::MultipleExclNoCreat);
return Err(ParseError::MultipleExclNoCreate);
}
}
ConvFlag::NoTrunc => oconvflags.notrunc = true,

View file

@ -23,3 +23,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "df"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "dircolors"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -8,7 +8,7 @@
/* last synced with: env (GNU coreutils) 8.13 */
// spell-checker:ignore (ToDO) chdir execvp progname subcommand subcommands unsets setenv putenv posix_spawnp
// spell-checker:ignore (ToDO) chdir execvp progname subcommand subcommands unsets setenv putenv spawnp
#[macro_use]
extern crate clap;
@ -280,7 +280,7 @@ fn run_env(args: impl uucore::Args) -> UResult<()> {
* exec*'s or in the description of env in the "Shell & Utilities" volume).
*
* It also doesn't specify any checks for putenv before modifying the environ variable, which
* is likely why glibc doesn't do so. However, setenv's first argument cannot point to
* is likely why glibc doesn't do so. However, the first set_var argument cannot point to
* an empty string or a string containing '='.
*
* There is no benefit in replicating GNU's env behavior, since it will only modify the

View file

@ -25,5 +25,4 @@ name = "expand"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -28,5 +28,4 @@ name = "expr"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -36,5 +36,4 @@ path = "src/main.rs"
path = "src/cli.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -26,5 +26,4 @@ name = "fmt"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "fold"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -22,3 +22,6 @@ clap = { version = "2.33", features = ["wrap_help"] }
[[bin]]
name = "groups"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -35,5 +35,4 @@ name = "hashsum"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "head"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -25,3 +25,6 @@ winapi = { version="0.3", features=["sysinfoapi", "winsock2"] }
[[bin]]
name = "hostname"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs", "winapi"]

View file

@ -24,5 +24,4 @@ name = "join"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "link"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -23,3 +23,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "logname"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -40,5 +40,4 @@ path = "src/main.rs"
feat_selinux = ["selinux"]
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -23,3 +23,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "mkfifo"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -24,3 +24,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "mknod"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -28,12 +28,11 @@ redox_termios = "0.1"
redox_syscall = "0.2"
[target.'cfg(all(unix, not(target_os = "fuchsia")))'.dependencies]
nix = "0.19"
nix = "=0.23.1"
[[bin]]
name = "more"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "mv"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -17,10 +17,13 @@ path = "src/nice.rs"
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
libc = "0.2.42"
nix = "0.20"
nix = "=0.23.1"
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
[[bin]]
name = "nice"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -29,5 +29,4 @@ name = "nl"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,3 +24,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "nohup"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -24,3 +24,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "nproc"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "numfmt"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -27,5 +27,4 @@ name = "od"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "paste"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -23,3 +23,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "pathchk"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -22,3 +22,6 @@ clap = { version = "2.33", features = ["wrap_help"] }
[[bin]]
name = "pinky"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -29,5 +29,4 @@ name = "pr"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "printenv"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -28,5 +28,4 @@ name = "printf"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -29,5 +29,4 @@ name = "ptx"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -18,7 +18,7 @@ static OPT_LOGICAL: &str = "logical";
static OPT_PHYSICAL: &str = "physical";
fn physical_path() -> io::Result<PathBuf> {
// std::env::current_dir() is a thin wrapper around libc's getcwd().
// std::env::current_dir() is a thin wrapper around libc::getcwd().
// On Unix, getcwd() must return the physical path:
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html

View file

@ -25,5 +25,4 @@ name = "readlink"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "realpath"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "relpath"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -29,5 +29,4 @@ name = "rm"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -28,5 +28,4 @@ name = "seq"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -26,5 +26,4 @@ name = "shred"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "shuf"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "split"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -22,3 +22,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "stat"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "sum"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,3 +24,6 @@ winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi"
[[bin]]
name = "sync"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs", "winapi"]

View file

@ -29,5 +29,4 @@ name = "tac"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -27,13 +27,11 @@ winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi",
redox_syscall = "0.2"
[target.'cfg(unix)'.dependencies]
nix = "0.20"
libc = "0.2"
nix = "=0.23.1"
[[bin]]
name = "tail"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -26,5 +26,4 @@ name = "tee"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -164,7 +164,7 @@ impl MultiWriter {
impl Write for MultiWriter {
fn write(&mut self, buf: &[u8]) -> Result<usize> {
self.writers.retain_mut(|writer| {
RetainMut::retain_mut(&mut self.writers, |writer| {
let result = writer.write_all(buf);
match result {
Err(f) => {
@ -178,7 +178,7 @@ impl Write for MultiWriter {
}
fn flush(&mut self) -> Result<()> {
self.writers.retain_mut(|writer| {
RetainMut::retain_mut(&mut self.writers, |writer| {
let result = writer.flush();
match result {
Err(f) => {

View file

@ -28,5 +28,4 @@ name = "test"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -17,7 +17,7 @@ path = "src/timeout.rs"
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
libc = "0.2.42"
nix = "0.20.0"
nix = "=0.23.1"
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["process", "signals"] }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
@ -25,3 +25,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "timeout"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -26,5 +26,4 @@ name = "tr"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "truncate"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,5 +24,4 @@ name = "tsort"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -24,3 +24,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "tty"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -23,3 +23,6 @@ uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_p
[[bin]]
name = "uname"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -25,5 +25,4 @@ name = "unexpand"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -26,5 +26,4 @@ name = "uniq"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -396,7 +396,7 @@ fn get_delimiter(matches: &ArgMatches) -> Delimiters {
.value_of(options::ALL_REPEATED)
.or_else(|| matches.value_of(options::GROUP));
if let Some(delimiter_arg) = value {
Delimiters::from_str(delimiter_arg).unwrap() // All possible values for ALL_REPEATED are &str's of Delimiters
Delimiters::from_str(delimiter_arg).unwrap() // All possible values for ALL_REPEATED are Delimiters (of type `&str`)
} else if matches.is_present(options::GROUP) {
Delimiters::Separate
} else {

View file

@ -23,7 +23,7 @@ utf-8 = "0.7.6"
unicode-width = "0.1.8"
[target.'cfg(unix)'.dependencies]
nix = "0.20"
nix = "=0.23.1"
libc = "0.2"
[[bin]]
@ -31,5 +31,4 @@ name = "wc"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
# Necessary for "make all"
normal = ["uucore_procs"]

View file

@ -22,3 +22,6 @@ clap = { version = "2.33", features = ["wrap_help"] }
[[bin]]
name = "who"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

View file

@ -20,7 +20,7 @@ uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=[
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
nix = "0.20.0"
nix = "=0.23.1"
[[bin]]
name = "yes"

View file

@ -55,16 +55,13 @@ type Result<T> = std::result::Result<T, Error>;
impl From<nix::Error> for Error {
fn from(error: nix::Error) -> Self {
match error {
nix::Error::Sys(errno) => Error::Io(io::Error::from_raw_os_error(errno as i32)),
_ => Error::Io(io::Error::last_os_error()),
}
Error::Io(io::Error::from_raw_os_error(error as i32))
}
}
fn maybe_unsupported(error: nix::Error) -> Error {
match error.as_errno() {
Some(Errno::EINVAL) | Some(Errno::ENOSYS) | Some(Errno::EBADF) => Error::Unsupported,
match error {
Errno::EINVAL | Errno::ENOSYS | Errno::EBADF => Error::Unsupported,
_ => error.into(),
}
}

View file

@ -34,7 +34,7 @@ os_display = "0.1.0"
[target.'cfg(unix)'.dependencies]
walkdir = { version="2.3.2", optional=true }
nix = { version="0.20", optional=true }
nix = { version="=0.23.1", optional=true }
[dev-dependencies]
clap = "2.33.3"

View file

@ -357,7 +357,7 @@ fn test_fullblock() {
of!(&tmp_fn),
"bs=128M",
// Note: In order for this test to actually test iflag=fullblock, the bs=VALUE
// must be big enough to 'overwhelm' urandom's store of bytes.
// must be big enough to 'overwhelm' the urandom store of bytes.
// Try executing 'dd if=/dev/urandom bs=128M count=1' (i.e without iflag=fullblock).
// The stats should contain the line: '0+1 records in' indicating a partial read.
// Since my system only copies 32 MiB without fullblock, I expect 128 MiB to be

View file

@ -290,7 +290,7 @@ fn test_interpret_backslash_at_eol_literally() {
#[cfg(not(target_os = "freebsd"))]
fn test_more_than_2_sets() {
new_ucmd!()
.args(&["'abcdefgh'", "'a", "'b'"])
.args(&["'abcdef'", "'a'", "'b'"])
.pipe_in("hello world")
.fails();
}

View file

@ -45,7 +45,7 @@ fn test_long_input() {
// try something long.
#[cfg(windows)]
const TIMES: usize = 500;
let arg = "abcdefg".repeat(TIMES) + "\n";
let arg = "abcdef".repeat(TIMES) + "\n";
let expected_out = arg.repeat(30);
run(&[&arg[..arg.len() - 1]], expected_out.as_bytes());
}

View file

@ -1166,13 +1166,13 @@ pub fn host_name_for(util_name: &str) -> Cow<str> {
{
// make call to `host_name_for` idempotent
if util_name.starts_with('g') && util_name != "groups" {
return util_name.into();
util_name.into()
} else {
return format!("g{}", util_name).into();
format!("g{}", util_name).into()
}
}
#[cfg(target_os = "linux")]
return util_name.into();
util_name.into()
}
// GNU coreutils version 8.32 is the reference version since it is the latest version and the

274
vendor/nix-v0.23.1-patched/.cirrus.yml vendored Normal file
View file

@ -0,0 +1,274 @@
cargo_cache:
folder: $CARGO_HOME/registry
fingerprint_script: cat Cargo.lock || echo ""
env:
# Build by default; don't just check
BUILD: build
CLIPPYFLAGS: -D warnings
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
TOOL: cargo
# The MSRV
TOOLCHAIN: 1.46.0
ZFLAGS:
# Tests that don't require executing the build binaries
build: &BUILD
build_script:
- . $HOME/.cargo/env || true
- $TOOL +$TOOLCHAIN $BUILD $ZFLAGS --target $TARGET --all-targets
- $TOOL +$TOOLCHAIN doc $ZFLAGS --no-deps --target $TARGET
- $TOOL +$TOOLCHAIN clippy $ZFLAGS --target $TARGET -- $CLIPPYFLAGS
# Tests that do require executing the binaries
test: &TEST
<< : *BUILD
test_script:
- . $HOME/.cargo/env || true
- $TOOL +$TOOLCHAIN test --target $TARGET
# Test FreeBSD in a full VM. Test the i686 target too, in the
# same VM. The binary will be built in 32-bit mode, but will execute on a
# 64-bit kernel and in a 64-bit environment. Our tests don't execute any of
# the system's binaries, so the environment shouldn't matter.
task:
name: FreeBSD amd64 & i686
env:
TARGET: x86_64-unknown-freebsd
freebsd_instance:
image: freebsd-12-2-release-amd64
setup_script:
- fetch https://sh.rustup.rs -o rustup.sh
- sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN
- . $HOME/.cargo/env
- rustup target add i686-unknown-freebsd
- rustup component add --toolchain $TOOLCHAIN clippy
<< : *TEST
i386_test_script:
- . $HOME/.cargo/env
- cargo build --target i686-unknown-freebsd
- cargo doc --no-deps --target i686-unknown-freebsd
- cargo test --target i686-unknown-freebsd
before_cache_script: rm -rf $CARGO_HOME/registry/index
# Test OSX in a full VM
task:
matrix:
- name: OSX x86_64
env:
TARGET: x86_64-apple-darwin
osx_instance:
image: catalina-xcode
setup_script:
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
- sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN
- . $HOME/.cargo/env
- rustup component add --toolchain $TOOLCHAIN clippy
<< : *TEST
before_cache_script: rm -rf $CARGO_HOME/registry/index
# Use cross for QEMU-based testing
# cross needs to execute Docker, so we must use Cirrus's Docker Builder task.
task:
env:
RUST_TEST_THREADS: 1 # QEMU works best with 1 thread
HOME: /tmp/home
PATH: $HOME/.cargo/bin:$PATH
RUSTFLAGS: --cfg qemu -D warnings
TOOL: cross
matrix:
- name: Linux arm gnueabi
env:
TARGET: arm-unknown-linux-gnueabi
- name: Linux armv7 gnueabihf
env:
TARGET: armv7-unknown-linux-gnueabihf
- name: Linux i686
env:
TARGET: i686-unknown-linux-gnu
- name: Linux i686 musl
env:
TARGET: i686-unknown-linux-musl
- name: Linux MIPS
env:
TARGET: mips-unknown-linux-gnu
- name: Linux MIPS64
env:
TARGET: mips64-unknown-linux-gnuabi64
- name: Linux MIPS64 el
env:
TARGET: mips64el-unknown-linux-gnuabi64
- name: Linux mipsel
env:
TARGET: mipsel-unknown-linux-gnu
- name: Linux powerpc64le
env:
TARGET: powerpc64le-unknown-linux-gnu
compute_engine_instance:
image_project: cirrus-images
image: family/docker-builder
platform: linux
cpu: 1 # Since QEMU will only use 1 thread
memory: 4G
setup_script:
- mkdir /tmp/home
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
- sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN
- . $HOME/.cargo/env
- cargo install cross
<< : *TEST
before_cache_script: rm -rf $CARGO_HOME/registry/index
# Tasks for Linux native builds
task:
matrix:
- name: Rust Stable
container:
image: rust:latest
env:
TARGET: x86_64-unknown-linux-gnu
TOOLCHAIN:
- name: Linux aarch64
arm_container:
image: rust:1.46
env:
RUSTFLAGS: --cfg graviton -D warnings
TARGET: aarch64-unknown-linux-gnu
- name: Linux x86_64
container:
image: rust:1.46
env:
TARGET: x86_64-unknown-linux-gnu
- name: Linux x86_64 musl
container:
image: rust:1.46
env:
TARGET: x86_64-unknown-linux-musl
setup_script:
- rustup target add $TARGET
- rustup component add clippy
<< : *TEST
before_cache_script: rm -rf $CARGO_HOME/registry/index
# Tasks for cross-compiling, but no testing
task:
container:
image: rust:1.46
env:
BUILD: check
matrix:
# Cross claims to support Android, but when it tries to run Nix's tests it
# reports undefined symbol references.
- name: Android aarch64
env:
TARGET: aarch64-linux-android
- name: Android arm
env:
TARGET: arm-linux-androideabi
- name: Android armv7
env:
TARGET: armv7-linux-androideabi
- name: Android i686
env:
TARGET: i686-linux-android
- name: Android x86_64
env:
TARGET: x86_64-linux-android
- name: Linux arm-musleabi
env:
TARGET: arm-unknown-linux-musleabi
- name: Fuchsia x86_64
env:
TARGET: x86_64-fuchsia
- name: Illumos
env:
TARGET: x86_64-unknown-illumos
# illumos toolchain isn't available via rustup until 1.50
TOOLCHAIN: 1.50.0
container:
image: rust:1.50
# Cross claims to support running tests on iOS, but it actually doesn't.
# https://github.com/rust-embedded/cross/issues/535
- name: iOS aarch64
env:
TARGET: aarch64-apple-ios
# Rustup only supports cross-building from arbitrary hosts for iOS at
# 1.49.0 and above. Below that it's possible to cross-build from an OSX
# host, but OSX VMs are more expensive than Linux VMs.
TOOLCHAIN: 1.49.0
- name: iOS x86_64
env:
TARGET: x86_64-apple-ios
TOOLCHAIN: 1.49.0
# Cross testing on powerpc fails with "undefined reference to renameat2".
# Perhaps cross is using too-old a version?
- name: Linux powerpc
env:
TARGET: powerpc-unknown-linux-gnu
# Cross claims to support Linux powerpc64, but it really doesn't.
# https://github.com/rust-embedded/cross/issues/441
- name: Linux powerpc64
env:
TARGET: powerpc64-unknown-linux-gnu
- name: Linux s390x
env:
TARGET: s390x-unknown-linux-gnu
- name: Linux x32
env:
TARGET: x86_64-unknown-linux-gnux32
- name: NetBSD x86_64
env:
TARGET: x86_64-unknown-netbsd
- name: Redox x86_64
env:
TARGET: x86_64-unknown-redox
# Redox requires a nightly compiler.
# If stuff breaks, change nightly to the date in the toolchain_*
# directory at https://static.redox-os.org
TOOLCHAIN: nightly-2020-08-04
setup_script:
- rustup target add $TARGET
- rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET
- rustup component add --toolchain $TOOLCHAIN clippy
<< : *BUILD
before_cache_script: rm -rf $CARGO_HOME/registry/index
# Rust Tier 3 targets can't use Rustup
task:
container:
image: rustlang/rust:nightly
env:
BUILD: check
# Must allow here rather than in lib.rs because this lint doesn't exist
# prior to Rust 1.57.0
# https://github.com/rust-lang/rust-clippy/issues/7718
CLIPPYFLAGS: -D warnings -A clippy::if_then_panic
TOOLCHAIN: nightly
ZFLAGS: -Zbuild-std
matrix:
- name: DragonFly BSD x86_64
env:
TARGET: x86_64-unknown-dragonfly
- name: OpenBSD x86_64
env:
TARGET: x86_64-unknown-openbsd
setup_script:
- rustup component add rust-src
<< : *BUILD
before_cache_script: rm -rf $CARGO_HOME/registry/index
# Test that we can build with the lowest version of all dependencies.
# "cargo test" doesn't work because some of our dev-dependencies, like
# rand, can't build with their own minimal dependencies.
task:
name: Minver
env:
TOOLCHAIN: nightly
container:
image: rustlang/rust:nightly
setup_script:
- cargo update -Zminimal-versions
script:
- cargo check
before_cache_script: rm -rf $CARGO_HOME/registry/index

View file

@ -0,0 +1 @@
/CHANGELOG.md merge=union

10
vendor/nix-v0.23.1-patched/.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
syntax: glob
Cargo.lock
target
*.diff
*.rej
*.orig
.*.swn
.*.swo
.*.swp
*.a

1227
vendor/nix-v0.23.1-patched/CHANGELOG.md vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,114 @@
# Contributing to nix
We're really glad you're interested in contributing to nix! This
document has a few pointers and guidelines to help get you started.
To have a welcoming and inclusive project, nix uses the Rust project's
[Code of Conduct][conduct]. All contributors are expected to follow it.
[conduct]: https://www.rust-lang.org/conduct.html
# Issues
We use GitHub's [issue tracker][issues].
[issues]: https://github.com/nix-rust/nix/issues
## Bug reports
Before submitting a new bug report, please [search existing
issues][issue-search] to see if there's something related. If not, just
[open a new issue][new-issue]!
As a reminder, the more information you can give in your issue, the
easier it is to figure out how to fix it. For nix, this will likely
include the OS and version, and the architecture.
[issue-search]: https://github.com/nix-rust/nix/search?utf8=%E2%9C%93&q=is%3Aissue&type=Issues
[new-issue]: https://github.com/nix-rust/nix/issues/new
## Feature / API requests
If you'd like a new API or feature added, please [open a new
issue][new-issue] requesting it. As with reporting a bug, the more
information you can provide, the better.
## Labels
We use labels to help manage issues. The structure is modeled after
[Rust's issue labeling scheme][rust-labels]:
- **A-** prefixed labels state which area of the project the issue
relates to
- **E-** prefixed labels explain the level of experience necessary to fix the
issue
- **O-** prefixed labels specify the OS for issues that are OS-specific
- **R-** prefixed labels specify the architecture for issues that are
architecture-specific
[rust-labels]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#issue-triage
# Pull requests
GitHub pull requests are the primary mechanism we use to change nix. GitHub itself has
some [great documentation][pr-docs] on using the Pull Request feature. We use the 'fork and
pull' model described there.
Please make pull requests against the `master` branch.
If you change the API by way of adding, removing or changing something or if
you fix a bug, please add an appropriate note to the [change log][cl]. We
follow the conventions of [Keep A CHANGELOG][kacl].
[cl]: https://github.com/nix-rust/nix/blob/master/CHANGELOG.md
[kacl]: https://github.com/olivierlacan/keep-a-changelog/tree/18adb5f5be7a898d046f6a4acb93e39dcf40c4ad
[pr-docs]: https://help.github.com/articles/using-pull-requests/
## Testing
nix has a test suite that you can run with `cargo test`. Ideally, we'd like pull
requests to include tests where they make sense. For example, when fixing a bug,
add a test that would have failed without the fix.
After you've made your change, make sure the tests pass in your development
environment. We also have [continuous integration set up on
Cirrus-CI][cirrus-ci], which might find some issues on other platforms. The CI
will run once you open a pull request.
There is also infrastructure for running tests for other targets
locally. More information is available in the [CI Readme][ci-readme].
[cirrus-ci]: https://cirrus-ci.com/github/nix-rust/nix
[ci-readme]: ci/README.md
### Disabling a test in the CI environment
Sometimes there are features that cannot be tested in the CI environment.
To stop a test from running under CI, add `skip_if_cirrus!()` to it. Please
describe the reason it shouldn't run under CI, and a link to an issue if
possible!
## bors, the bot who merges all the PRs
All pull requests are merged via [bors], an integration bot. After the
pull request has been reviewed, the reviewer will leave a comment like
> bors r+
to let bors know that it was approved. Then bors will check that it passes
tests when merged with the latest changes in the `master` branch, and
merge if the tests succeed.
[bors]: https://bors-ng.github.io/
## API conventions
If you're adding a new API, we have a [document with
conventions][conventions] to use throughout the nix project.
[conventions]: https://github.com/nix-rust/nix/blob/master/CONVENTIONS.md

View file

@ -0,0 +1,86 @@
# Conventions
In order to achieve our goal of wrapping [libc][libc] code in idiomatic rust
constructs with minimal performance overhead, we follow the following
conventions.
Note that, thus far, not all the code follows these conventions and not all
conventions we try to follow have been documented here. If you find an instance
of either, feel free to remedy the flaw by opening a pull request with
appropriate changes or additions.
## Change Log
We follow the conventions laid out in [Keep A CHANGELOG][kacl].
[kacl]: https://github.com/olivierlacan/keep-a-changelog/tree/18adb5f5be7a898d046f6a4acb93e39dcf40c4ad
## libc constants, functions and structs
We do not define integer constants ourselves, but use or reexport them from the
[libc crate][libc].
We use the functions exported from [libc][libc] instead of writing our own
`extern` declarations.
We use the `struct` definitions from [libc][libc] internally instead of writing
our own. If we want to add methods to a libc type, we use the newtype pattern.
For example,
```rust
pub struct SigSet(libc::sigset_t);
impl SigSet {
...
}
```
When creating newtypes, we use Rust's `CamelCase` type naming convention.
## Bitflags
Many C functions have flags parameters that are combined from constants using
bitwise operations. We represent the types of these parameters by types defined
using our `libc_bitflags!` macro, which is a convenience wrapper around the
`bitflags!` macro from the [bitflags crate][bitflags] that brings in the
constant value from `libc`.
We name the type for a set of constants whose element's names start with `FOO_`
`FooFlags`.
For example,
```rust
libc_bitflags!{
pub struct ProtFlags: libc::c_int {
PROT_NONE;
PROT_READ;
PROT_WRITE;
PROT_EXEC;
#[cfg(any(target_os = "linux", target_os = "android"))]
PROT_GROWSDOWN;
#[cfg(any(target_os = "linux", target_os = "android"))]
PROT_GROWSUP;
}
}
```
## Enumerations
We represent sets of constants that are intended as mutually exclusive arguments
to parameters of functions by [enumerations][enum].
## Structures Initialized by libc Functions
Whenever we need to use a [libc][libc] function to properly initialize a
variable and said function allows us to use uninitialized memory, we use
[`std::mem::MaybeUninit`][std_MaybeUninit] when defining the variable. This
allows us to avoid the overhead incurred by zeroing or otherwise initializing
the variable.
[bitflags]: https://crates.io/crates/bitflags/
[enum]: https://doc.rust-lang.org/reference.html#enumerations
[libc]: https://crates.io/crates/libc/
[std_MaybeUninit]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html

74
vendor/nix-v0.23.1-patched/Cargo.toml vendored Normal file
View file

@ -0,0 +1,74 @@
[package]
name = "nix"
description = "Rust friendly bindings to *nix APIs"
edition = "2018"
version = "0.23.1"
authors = ["The nix-rust Project Developers"]
repository = "https://github.com/nix-rust/nix"
license = "MIT"
categories = ["os::unix-apis"]
include = ["src/**/*", "LICENSE", "README.md", "CHANGELOG.md"]
[package.metadata.docs.rs]
targets = [
"x86_64-unknown-linux-gnu",
"aarch64-linux-android",
"x86_64-apple-darwin",
"aarch64-apple-ios",
"x86_64-unknown-freebsd",
"x86_64-unknown-openbsd",
"x86_64-unknown-netbsd",
"x86_64-unknown-dragonfly",
"x86_64-fuchsia",
"x86_64-unknown-redox",
"x86_64-unknown-illumos"
]
[dependencies]
libc = { version = "0.2.102", features = [ "extra_traits" ] }
bitflags = "1.3.1"
cfg-if = "1.0"
[target.'cfg(not(target_os = "redox"))'.dependencies]
memoffset = "0.6.3"
[target.'cfg(target_os = "dragonfly")'.build-dependencies]
cc = "1"
[dev-dependencies]
assert-impl = "0.1"
lazy_static = "1.2"
rand = "0.8"
tempfile = "3.2.0"
semver = "1.0.0"
[target.'cfg(any(target_os = "android", target_os = "linux"))'.dev-dependencies]
caps = "0.5.1"
[target.'cfg(target_os = "freebsd")'.dev-dependencies]
sysctl = "0.1"
[[test]]
name = "test"
path = "test/test.rs"
[[test]]
name = "test-aio-drop"
path = "test/sys/test_aio_drop.rs"
[[test]]
name = "test-clearenv"
path = "test/test_clearenv.rs"
[[test]]
name = "test-lio-listio-resubmit"
path = "test/sys/test_lio_listio_resubmit.rs"
[[test]]
name = "test-mount"
path = "test/test_mount.rs"
harness = false
[[test]]
name = "test-ptymaster-drop"
path = "test/test_ptymaster_drop.rs"

Some files were not shown because too many files have changed in this diff Show more