mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
This commit is contained in:
commit
c86cb91dee
213 changed files with 35450 additions and 439 deletions
467
.github/workflows/CICD.yml
vendored
467
.github/workflows/CICD.yml
vendored
|
@ -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
2
.vscode/cSpell.json
vendored
|
@ -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
|
||||
|
|
50
Cargo.lock
generated
50
Cargo.lock
generated
|
@ -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"
|
||||
|
@ -305,7 +303,7 @@ dependencies = [
|
|||
"glob",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"nix 0.20.0",
|
||||
"nix 0.23.1",
|
||||
"pretty_assertions",
|
||||
"rand 0.7.3",
|
||||
"regex",
|
||||
|
@ -610,7 +608,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",
|
||||
]
|
||||
|
||||
|
@ -1100,30 +1098,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"
|
||||
|
@ -1139,9 +1113,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",
|
||||
|
@ -2218,7 +2190,7 @@ version = "0.0.8"
|
|||
dependencies = [
|
||||
"atty",
|
||||
"clap",
|
||||
"nix 0.20.0",
|
||||
"nix 0.23.1",
|
||||
"thiserror",
|
||||
"unix_socket",
|
||||
"uucore",
|
||||
|
@ -2693,7 +2665,7 @@ dependencies = [
|
|||
"atty",
|
||||
"clap",
|
||||
"crossterm",
|
||||
"nix 0.19.1",
|
||||
"nix 0.23.1",
|
||||
"redox_syscall",
|
||||
"redox_termios",
|
||||
"unicode-segmentation",
|
||||
|
@ -2718,7 +2690,7 @@ version = "0.0.8"
|
|||
dependencies = [
|
||||
"clap",
|
||||
"libc",
|
||||
"nix 0.20.0",
|
||||
"nix 0.23.1",
|
||||
"uucore",
|
||||
"uucore_procs",
|
||||
]
|
||||
|
@ -3067,7 +3039,7 @@ version = "0.0.8"
|
|||
dependencies = [
|
||||
"clap",
|
||||
"libc",
|
||||
"nix 0.20.0",
|
||||
"nix 0.23.1",
|
||||
"redox_syscall",
|
||||
"uucore",
|
||||
"uucore_procs",
|
||||
|
@ -3102,7 +3074,7 @@ version = "0.0.8"
|
|||
dependencies = [
|
||||
"clap",
|
||||
"libc",
|
||||
"nix 0.20.0",
|
||||
"nix 0.23.1",
|
||||
"uucore",
|
||||
"uucore_procs",
|
||||
]
|
||||
|
@ -3232,7 +3204,7 @@ dependencies = [
|
|||
"bytecount",
|
||||
"clap",
|
||||
"libc",
|
||||
"nix 0.20.0",
|
||||
"nix 0.23.1",
|
||||
"unicode-width",
|
||||
"utf-8",
|
||||
"uucore",
|
||||
|
@ -3264,7 +3236,7 @@ name = "uu_yes"
|
|||
version = "0.0.8"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"nix 0.20.0",
|
||||
"nix 0.23.1",
|
||||
"uucore",
|
||||
"uucore_procs",
|
||||
]
|
||||
|
@ -3281,7 +3253,7 @@ dependencies = [
|
|||
"getopts",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"nix 0.20.0",
|
||||
"nix 0.23.1",
|
||||
"once_cell",
|
||||
"os_display",
|
||||
"termion",
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "base32"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "base64"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "basename"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
|
||||
// spell-checker:ignore (ToDO) fullname
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::path::{is_separator, PathBuf};
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{UResult, UUsageError};
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
static SUMMARY: &str = "Print NAME with any leading directory components removed
|
||||
|
@ -32,7 +31,8 @@ pub mod options {
|
|||
pub static ZERO: &str = "zero";
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
@ -44,12 +44,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
|
||||
// too few arguments
|
||||
if !matches.is_present(options::NAME) {
|
||||
crash!(
|
||||
1,
|
||||
"{1}\nTry '{0} --help' for more information.",
|
||||
uucore::execution_phrase(),
|
||||
"missing operand"
|
||||
);
|
||||
return Err(UUsageError::new(1, "missing operand".to_string()));
|
||||
}
|
||||
|
||||
let opt_suffix = matches.is_present(options::SUFFIX);
|
||||
|
@ -58,12 +53,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
let multiple_paths = opt_suffix || opt_multiple;
|
||||
// too many arguments
|
||||
if !multiple_paths && matches.occurrences_of(options::NAME) > 2 {
|
||||
crash!(
|
||||
return Err(UUsageError::new(
|
||||
1,
|
||||
"extra operand '{1}'\nTry '{0} --help' for more information.",
|
||||
uucore::execution_phrase(),
|
||||
matches.values_of(options::NAME).unwrap().nth(2).unwrap()
|
||||
);
|
||||
format!(
|
||||
"extra operand {}",
|
||||
matches
|
||||
.values_of(options::NAME)
|
||||
.unwrap()
|
||||
.nth(2)
|
||||
.unwrap()
|
||||
.quote()
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
let suffix = if opt_suffix {
|
||||
|
@ -89,7 +90,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
print!("{}{}", basename(path, suffix), line_ending);
|
||||
}
|
||||
|
||||
0
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app() -> App<'static, 'static> {
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "basenc"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -25,3 +25,6 @@ libc = { version = "0.2" }
|
|||
[[bin]]
|
||||
name = "chcon"
|
||||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -24,3 +24,6 @@ walkdir = "2.2"
|
|||
[[bin]]
|
||||
name = "chmod"
|
||||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "cksum"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "comm"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -47,5 +47,4 @@ feat_selinux = ["selinux"]
|
|||
feat_acl = ["exacl"]
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -26,5 +26,4 @@ name = "csplit"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -27,5 +27,4 @@ name = "cut"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -31,5 +31,4 @@ name = "date"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -18,6 +18,9 @@ use std::fs::File;
|
|||
use std::io::{BufRead, BufReader};
|
||||
use std::path::PathBuf;
|
||||
use uucore::display::Quotable;
|
||||
#[cfg(not(any(target_os = "macos", target_os = "redox")))]
|
||||
use uucore::error::FromIo;
|
||||
use uucore::error::{UResult, USimpleError};
|
||||
use uucore::show_error;
|
||||
#[cfg(windows)]
|
||||
use winapi::{
|
||||
|
@ -137,7 +140,8 @@ impl<'a> From<&'a str> for Rfc3339Format {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let syntax = format!(
|
||||
"{0} [OPTION]... [+FORMAT]...
|
||||
{0} [OPTION]... [MMDDhhmm[[CC]YY][.ss]]",
|
||||
|
@ -147,8 +151,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
|
||||
let format = if let Some(form) = matches.value_of(OPT_FORMAT) {
|
||||
if !form.starts_with('+') {
|
||||
show_error!("invalid date {}", form.quote());
|
||||
return 1;
|
||||
return Err(USimpleError::new(
|
||||
1,
|
||||
format!("invalid date {}", form.quote()),
|
||||
));
|
||||
}
|
||||
let form = form[1..].to_string();
|
||||
Format::Custom(form)
|
||||
|
@ -176,8 +182,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
let set_to = match matches.value_of(OPT_SET).map(parse_date) {
|
||||
None => None,
|
||||
Some(Err((input, _err))) => {
|
||||
show_error!("invalid date {}", input.quote());
|
||||
return 1;
|
||||
return Err(USimpleError::new(
|
||||
1,
|
||||
format!("invalid date {}", input.quote()),
|
||||
));
|
||||
}
|
||||
Some(Ok(date)) => Some(date),
|
||||
};
|
||||
|
@ -241,14 +249,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
let formatted = date.format(format_string).to_string().replace("%f", "%N");
|
||||
println!("{}", formatted);
|
||||
}
|
||||
Err((input, _err)) => {
|
||||
show_error!("invalid date {}", input.quote());
|
||||
}
|
||||
Err((input, _err)) => show_error!("invalid date {}", input.quote()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
0
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app() -> App<'static, 'static> {
|
||||
|
@ -348,20 +354,24 @@ fn parse_date<S: AsRef<str> + Clone>(
|
|||
}
|
||||
|
||||
#[cfg(not(any(unix, windows)))]
|
||||
fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
|
||||
fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
|
||||
unimplemented!("setting date not implemented (unsupported target)");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
|
||||
show_error!("setting the date is not supported by macOS");
|
||||
1
|
||||
fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
|
||||
Err(USimpleError::new(
|
||||
1,
|
||||
"setting the date is not supported by macOS".to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
|
||||
show_error!("setting the date is not supported by Redox");
|
||||
1
|
||||
fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
|
||||
Err(USimpleError::new(
|
||||
1,
|
||||
"setting the date is not supported by Redox".to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
|
@ -370,7 +380,7 @@ fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
|
|||
/// https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html
|
||||
/// https://linux.die.net/man/3/clock_settime
|
||||
/// https://www.gnu.org/software/libc/manual/html_node/Time-Types.html
|
||||
fn set_system_datetime(date: DateTime<Utc>) -> i32 {
|
||||
fn set_system_datetime(date: DateTime<Utc>) -> UResult<()> {
|
||||
let timespec = timespec {
|
||||
tv_sec: date.timestamp() as _,
|
||||
tv_nsec: date.timestamp_subsec_nanos() as _,
|
||||
|
@ -379,11 +389,9 @@ fn set_system_datetime(date: DateTime<Utc>) -> i32 {
|
|||
let result = unsafe { clock_settime(CLOCK_REALTIME, ×pec) };
|
||||
|
||||
if result != 0 {
|
||||
let error = std::io::Error::last_os_error();
|
||||
show_error!("cannot set date: {}", error);
|
||||
error.raw_os_error().unwrap()
|
||||
Err(std::io::Error::last_os_error().map_err_context(|| "cannot set date".to_string()))
|
||||
} else {
|
||||
0
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,7 +400,7 @@ fn set_system_datetime(date: DateTime<Utc>) -> i32 {
|
|||
/// See here for more:
|
||||
/// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-setsystemtime
|
||||
/// https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime
|
||||
fn set_system_datetime(date: DateTime<Utc>) -> i32 {
|
||||
fn set_system_datetime(date: DateTime<Utc>) -> UResult<()> {
|
||||
let system_time = SYSTEMTIME {
|
||||
wYear: date.year() as WORD,
|
||||
wMonth: date.month() as WORD,
|
||||
|
@ -409,10 +417,8 @@ fn set_system_datetime(date: DateTime<Utc>) -> i32 {
|
|||
let result = unsafe { SetSystemTime(&system_time) };
|
||||
|
||||
if result == 0 {
|
||||
let error = std::io::Error::last_os_error();
|
||||
show_error!("cannot set date: {}", error);
|
||||
error.raw_os_error().unwrap()
|
||||
Err(std::io::Error::last_os_error().map_err_context(|| "cannot set date".to_string()))
|
||||
} else {
|
||||
0
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,5 +33,4 @@ name = "dd"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "dircolors"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
4
src/uu/env/src/env.rs
vendored
4
src/uu/env/src/env.rs
vendored
|
@ -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
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "expand"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -28,5 +28,4 @@ name = "expr"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -36,5 +36,4 @@ path = "src/main.rs"
|
|||
path = "src/cli.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -26,5 +26,4 @@ name = "fmt"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "fold"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -7,13 +7,12 @@
|
|||
|
||||
// spell-checker:ignore (ToDOs) ncount routput
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, BufRead, BufReader, Read};
|
||||
use std::path::Path;
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
const TAB_WIDTH: usize = 8;
|
||||
|
@ -30,7 +29,8 @@ mod options {
|
|||
pub const FILE: &str = "file";
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
@ -46,10 +46,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
};
|
||||
|
||||
let width = match poss_width {
|
||||
Some(inp_width) => match inp_width.parse::<usize>() {
|
||||
Ok(width) => width,
|
||||
Err(e) => crash!(1, "illegal width value (\"{}\"): {}", inp_width, e),
|
||||
},
|
||||
Some(inp_width) => inp_width.parse::<usize>().map_err(|e| {
|
||||
USimpleError::new(
|
||||
1,
|
||||
format!("illegal width value ({}): {}", inp_width.quote(), e),
|
||||
)
|
||||
})?,
|
||||
None => 80,
|
||||
};
|
||||
|
||||
|
@ -58,9 +60,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
None => vec!["-".to_owned()],
|
||||
};
|
||||
|
||||
fold(files, bytes, spaces, width);
|
||||
|
||||
0
|
||||
fold(files, bytes, spaces, width)
|
||||
}
|
||||
|
||||
pub fn uu_app() -> App<'static, 'static> {
|
||||
|
@ -110,7 +110,7 @@ fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) {
|
|||
(args.to_vec(), None)
|
||||
}
|
||||
|
||||
fn fold(filenames: Vec<String>, bytes: bool, spaces: bool, width: usize) {
|
||||
fn fold(filenames: Vec<String>, bytes: bool, spaces: bool, width: usize) -> UResult<()> {
|
||||
for filename in &filenames {
|
||||
let filename: &str = filename;
|
||||
let mut stdin_buf;
|
||||
|
@ -119,16 +119,17 @@ fn fold(filenames: Vec<String>, bytes: bool, spaces: bool, width: usize) {
|
|||
stdin_buf = stdin();
|
||||
&mut stdin_buf as &mut dyn Read
|
||||
} else {
|
||||
file_buf = crash_if_err!(1, File::open(Path::new(filename)));
|
||||
file_buf = File::open(Path::new(filename)).map_err_context(|| filename.to_string())?;
|
||||
&mut file_buf as &mut dyn Read
|
||||
});
|
||||
|
||||
if bytes {
|
||||
fold_file_bytewise(buffer, spaces, width);
|
||||
fold_file_bytewise(buffer, spaces, width)?;
|
||||
} else {
|
||||
fold_file(buffer, spaces, width);
|
||||
fold_file(buffer, spaces, width)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Fold `file` to fit `width` (number of columns), counting all characters as
|
||||
|
@ -139,11 +140,15 @@ fn fold(filenames: Vec<String>, bytes: bool, spaces: bool, width: usize) {
|
|||
/// to all other characters in the stream.
|
||||
///
|
||||
/// If `spaces` is `true`, attempt to break lines at whitespace boundaries.
|
||||
fn fold_file_bytewise<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) {
|
||||
fn fold_file_bytewise<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) -> UResult<()> {
|
||||
let mut line = String::new();
|
||||
|
||||
loop {
|
||||
if let Ok(0) = file.read_line(&mut line) {
|
||||
if file
|
||||
.read_line(&mut line)
|
||||
.map_err_context(|| "failed to read line".to_string())?
|
||||
== 0
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -190,6 +195,8 @@ fn fold_file_bytewise<T: Read>(mut file: BufReader<T>, spaces: bool, width: usiz
|
|||
|
||||
line.truncate(0);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Fold `file` to fit `width` (number of columns).
|
||||
|
@ -200,7 +207,7 @@ fn fold_file_bytewise<T: Read>(mut file: BufReader<T>, spaces: bool, width: usiz
|
|||
///
|
||||
/// If `spaces` is `true`, attempt to break lines at whitespace boundaries.
|
||||
#[allow(unused_assignments)]
|
||||
fn fold_file<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) {
|
||||
fn fold_file<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) -> UResult<()> {
|
||||
let mut line = String::new();
|
||||
let mut output = String::new();
|
||||
let mut col_count = 0;
|
||||
|
@ -230,7 +237,11 @@ fn fold_file<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) {
|
|||
}
|
||||
|
||||
loop {
|
||||
if let Ok(0) = file.read_line(&mut line) {
|
||||
if file
|
||||
.read_line(&mut line)
|
||||
.map_err_context(|| "failed to read line".to_string())?
|
||||
== 0
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -281,4 +292,6 @@ fn fold_file<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) {
|
|||
|
||||
line.truncate(0);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -35,5 +35,4 @@ name = "hashsum"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "head"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "join"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "link"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -40,5 +40,4 @@ path = "src/main.rs"
|
|||
feat_selinux = ["selinux"]
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "mv"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -29,5 +29,4 @@ name = "nl"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
normal = ["uucore_procs"]
|
|
@ -8,14 +8,12 @@
|
|||
|
||||
// spell-checker:ignore (ToDO) corasick memchr
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, BufRead, BufReader, Read};
|
||||
use std::iter::repeat;
|
||||
use std::path::Path;
|
||||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
mod helper;
|
||||
|
@ -83,7 +81,8 @@ pub mod options {
|
|||
pub const NUMBER_WIDTH: &str = "number-width";
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
@ -109,11 +108,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
// program if some options could not successfully be parsed.
|
||||
let parse_errors = helper::parse_options(&mut settings, &matches);
|
||||
if !parse_errors.is_empty() {
|
||||
show_error!("Invalid arguments supplied.");
|
||||
for message in &parse_errors {
|
||||
println!("{}", message);
|
||||
}
|
||||
return 1;
|
||||
return Err(USimpleError::new(
|
||||
1,
|
||||
format!("Invalid arguments supplied.\n{}", parse_errors.join("\n")),
|
||||
));
|
||||
}
|
||||
|
||||
let mut read_stdin = false;
|
||||
|
@ -130,16 +128,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
continue;
|
||||
}
|
||||
let path = Path::new(file);
|
||||
let reader = File::open(path).unwrap();
|
||||
let reader = File::open(path).map_err_context(|| file.to_string())?;
|
||||
let mut buffer = BufReader::new(reader);
|
||||
nl(&mut buffer, &settings);
|
||||
nl(&mut buffer, &settings)?;
|
||||
}
|
||||
|
||||
if read_stdin {
|
||||
let mut buffer = BufReader::new(stdin());
|
||||
nl(&mut buffer, &settings);
|
||||
nl(&mut buffer, &settings)?;
|
||||
}
|
||||
0
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app() -> App<'static, 'static> {
|
||||
|
@ -227,7 +225,7 @@ pub fn uu_app() -> App<'static, 'static> {
|
|||
}
|
||||
|
||||
// nl implements the main functionality for an individual buffer.
|
||||
fn nl<T: Read>(reader: &mut BufReader<T>, settings: &Settings) {
|
||||
fn nl<T: Read>(reader: &mut BufReader<T>, settings: &Settings) -> UResult<()> {
|
||||
let regexp: regex::Regex = regex::Regex::new(r".?").unwrap();
|
||||
let mut line_no = settings.starting_line_number;
|
||||
// The current line number's width as a string. Using to_string is inefficient
|
||||
|
@ -248,7 +246,8 @@ fn nl<T: Read>(reader: &mut BufReader<T>, settings: &Settings) {
|
|||
_ => ®exp,
|
||||
};
|
||||
let mut line_filter: fn(&str, ®ex::Regex) -> bool = pass_regex;
|
||||
for mut l in reader.lines().map(|r| r.unwrap()) {
|
||||
for l in reader.lines() {
|
||||
let mut l = l.map_err_context(|| "could not read line".to_string())?;
|
||||
// Sanitize the string. We want to print the newline ourselves.
|
||||
if l.ends_with('\n') {
|
||||
l.pop();
|
||||
|
@ -372,6 +371,7 @@ fn nl<T: Read>(reader: &mut BufReader<T>, settings: &Settings) {
|
|||
line_no_width += 1;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn pass_regex(line: &str, re: ®ex::Regex) -> bool {
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
|
||||
// spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{crate_version, App, Arg};
|
||||
use std::env;
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{UResult, USimpleError};
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const _SC_NPROCESSORS_CONF: libc::c_int = 83;
|
||||
|
@ -31,7 +30,8 @@ fn usage() -> String {
|
|||
format!("{0} [OPTIONS]...", uucore::execution_phrase())
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
|
@ -39,8 +39,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
Some(numstr) => match numstr.parse() {
|
||||
Ok(num) => num,
|
||||
Err(e) => {
|
||||
show_error!("\"{}\" is not a valid number: {}", numstr, e);
|
||||
return 1;
|
||||
return Err(USimpleError::new(
|
||||
1,
|
||||
format!("{} is not a valid number: {}", numstr.quote(), e),
|
||||
));
|
||||
}
|
||||
},
|
||||
None => 0,
|
||||
|
@ -66,7 +68,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
cores -= ignore;
|
||||
}
|
||||
println!("{}", cores);
|
||||
0
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app() -> App<'static, 'static> {
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "numfmt"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
normal = ["uucore_procs"]
|
|
@ -27,5 +27,4 @@ name = "od"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "paste"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -29,5 +29,4 @@ name = "pr"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "printenv"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -28,5 +28,4 @@ name = "printf"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -29,5 +29,4 @@ name = "ptx"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "readlink"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "realpath"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "relpath"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -29,5 +29,4 @@ name = "rm"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -28,5 +28,4 @@ name = "seq"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -26,5 +26,4 @@ name = "shred"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "shuf"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -7,14 +7,12 @@
|
|||
|
||||
// spell-checker:ignore (ToDO) cmdline evec seps rvec fdata
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{crate_version, App, Arg};
|
||||
use rand::Rng;
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
use uucore::InvalidEncodingHandling;
|
||||
|
||||
enum Mode {
|
||||
|
@ -52,7 +50,8 @@ mod options {
|
|||
pub static FILE: &str = "file";
|
||||
}
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let args = args
|
||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||
.accept_any();
|
||||
|
@ -65,7 +64,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
match parse_range(range) {
|
||||
Ok(m) => Mode::InputRange(m),
|
||||
Err(msg) => {
|
||||
crash!(1, "{}", msg);
|
||||
return Err(USimpleError::new(1, msg));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -77,8 +76,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
Some(count) => match count.parse::<usize>() {
|
||||
Ok(val) => val,
|
||||
Err(_) => {
|
||||
show_error!("invalid line count: {}", count.quote());
|
||||
return 1;
|
||||
return Err(USimpleError::new(
|
||||
1,
|
||||
format!("invalid line count: {}", count.quote()),
|
||||
));
|
||||
}
|
||||
},
|
||||
None => std::usize::MAX,
|
||||
|
@ -97,22 +98,22 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
Mode::Echo(args) => {
|
||||
let mut evec = args.iter().map(String::as_bytes).collect::<Vec<_>>();
|
||||
find_seps(&mut evec, options.sep);
|
||||
shuf_bytes(&mut evec, options);
|
||||
shuf_bytes(&mut evec, options)?;
|
||||
}
|
||||
Mode::InputRange((b, e)) => {
|
||||
let rvec = (b..e).map(|x| format!("{}", x)).collect::<Vec<String>>();
|
||||
let mut rvec = rvec.iter().map(String::as_bytes).collect::<Vec<&[u8]>>();
|
||||
shuf_bytes(&mut rvec, options);
|
||||
shuf_bytes(&mut rvec, options)?;
|
||||
}
|
||||
Mode::Default(filename) => {
|
||||
let fdata = read_input_file(&filename);
|
||||
let fdata = read_input_file(&filename)?;
|
||||
let mut fdata = vec![&fdata[..]];
|
||||
find_seps(&mut fdata, options.sep);
|
||||
shuf_bytes(&mut fdata, options);
|
||||
shuf_bytes(&mut fdata, options)?;
|
||||
}
|
||||
}
|
||||
|
||||
0
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app() -> App<'static, 'static> {
|
||||
|
@ -180,22 +181,20 @@ pub fn uu_app() -> App<'static, 'static> {
|
|||
.arg(Arg::with_name(options::FILE).takes_value(true))
|
||||
}
|
||||
|
||||
fn read_input_file(filename: &str) -> Vec<u8> {
|
||||
fn read_input_file(filename: &str) -> UResult<Vec<u8>> {
|
||||
let mut file = BufReader::new(if filename == "-" {
|
||||
Box::new(stdin()) as Box<dyn Read>
|
||||
} else {
|
||||
match File::open(filename) {
|
||||
Ok(f) => Box::new(f) as Box<dyn Read>,
|
||||
Err(e) => crash!(1, "failed to open {}: {}", filename.quote(), e),
|
||||
}
|
||||
let file = File::open(filename)
|
||||
.map_err_context(|| format!("failed to open {}", filename.quote()))?;
|
||||
Box::new(file) as Box<dyn Read>
|
||||
});
|
||||
|
||||
let mut data = Vec::new();
|
||||
if let Err(e) = file.read_to_end(&mut data) {
|
||||
crash!(1, "failed reading {}: {}", filename.quote(), e)
|
||||
};
|
||||
file.read_to_end(&mut data)
|
||||
.map_err_context(|| format!("failed reading {}", filename.quote()))?;
|
||||
|
||||
data
|
||||
Ok(data)
|
||||
}
|
||||
|
||||
fn find_seps(data: &mut Vec<&[u8]>, sep: u8) {
|
||||
|
@ -231,22 +230,22 @@ fn find_seps(data: &mut Vec<&[u8]>, sep: u8) {
|
|||
}
|
||||
}
|
||||
|
||||
fn shuf_bytes(input: &mut Vec<&[u8]>, opts: Options) {
|
||||
fn shuf_bytes(input: &mut Vec<&[u8]>, opts: Options) -> UResult<()> {
|
||||
let mut output = BufWriter::new(match opts.output {
|
||||
None => Box::new(stdout()) as Box<dyn Write>,
|
||||
Some(s) => match File::create(&s[..]) {
|
||||
Ok(f) => Box::new(f) as Box<dyn Write>,
|
||||
Err(e) => crash!(1, "failed to open {} for writing: {}", s.quote(), e),
|
||||
},
|
||||
Some(s) => {
|
||||
let file = File::create(&s[..])
|
||||
.map_err_context(|| format!("failed to open {} for writing", s.quote()))?;
|
||||
Box::new(file) as Box<dyn Write>
|
||||
}
|
||||
});
|
||||
|
||||
let mut rng = match opts.random_source {
|
||||
Some(r) => WrappedRng::RngFile(rand::rngs::adapter::ReadRng::new(
|
||||
match File::open(&r[..]) {
|
||||
Ok(f) => f,
|
||||
Err(e) => crash!(1, "failed to open random source {}: {}", r.quote(), e),
|
||||
},
|
||||
)),
|
||||
Some(r) => {
|
||||
let file = File::open(&r[..])
|
||||
.map_err_context(|| format!("failed to open random source {}", r.quote()))?;
|
||||
WrappedRng::RngFile(rand::rngs::adapter::ReadRng::new(file))
|
||||
}
|
||||
None => WrappedRng::RngDefault(rand::thread_rng()),
|
||||
};
|
||||
|
||||
|
@ -268,10 +267,10 @@ fn shuf_bytes(input: &mut Vec<&[u8]>, opts: Options) {
|
|||
// write the randomly chosen value and the separator
|
||||
output
|
||||
.write_all(input[r])
|
||||
.unwrap_or_else(|e| crash!(1, "write failed: {}", e));
|
||||
.map_err_context(|| "write failed".to_string())?;
|
||||
output
|
||||
.write_all(&[opts.sep])
|
||||
.unwrap_or_else(|e| crash!(1, "write failed: {}", e));
|
||||
.map_err_context(|| "write failed".to_string())?;
|
||||
|
||||
// if we do not allow repeats, remove the chosen value from the input vector
|
||||
if !opts.repeat {
|
||||
|
@ -284,6 +283,7 @@ fn shuf_bytes(input: &mut Vec<&[u8]>, opts: Options) {
|
|||
|
||||
count -= 1;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn parse_range(input_range: &str) -> Result<(usize, usize), String> {
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "split"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "sum"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -29,5 +29,4 @@ name = "tac"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -191,7 +191,7 @@ fn uu_tail(settings: &Settings) -> UResult<()> {
|
|||
|
||||
if use_stdin {
|
||||
let mut reader = BufReader::new(stdin());
|
||||
unbounded_tail(&mut reader, settings);
|
||||
unbounded_tail(&mut reader, settings)?;
|
||||
|
||||
// Don't follow stdin since there are no checks for pipes/FIFOs
|
||||
//
|
||||
|
@ -230,7 +230,7 @@ fn uu_tail(settings: &Settings) -> UResult<()> {
|
|||
}
|
||||
} else {
|
||||
let mut reader = BufReader::new(file);
|
||||
unbounded_tail(&mut reader, settings);
|
||||
unbounded_tail(&mut reader, settings)?;
|
||||
if settings.follow {
|
||||
readers.push((Box::new(reader), filename));
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ fn uu_tail(settings: &Settings) -> UResult<()> {
|
|||
}
|
||||
|
||||
if settings.follow {
|
||||
follow(&mut readers[..], settings);
|
||||
follow(&mut readers[..], settings)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -342,10 +342,9 @@ pub fn uu_app() -> App<'static, 'static> {
|
|||
)
|
||||
}
|
||||
|
||||
fn follow<T: BufRead>(readers: &mut [(T, &String)], settings: &Settings) {
|
||||
assert!(settings.follow);
|
||||
if readers.is_empty() {
|
||||
return;
|
||||
fn follow<T: BufRead>(readers: &mut [(T, &String)], settings: &Settings) -> UResult<()> {
|
||||
if readers.is_empty() || !settings.follow {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let mut last = readers.len() - 1;
|
||||
|
@ -372,7 +371,7 @@ fn follow<T: BufRead>(readers: &mut [(T, &String)], settings: &Settings) {
|
|||
}
|
||||
print!("{}", datum);
|
||||
}
|
||||
Err(err) => panic!("{}", err),
|
||||
Err(err) => return Err(USimpleError::new(1, err.to_string())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -381,6 +380,7 @@ fn follow<T: BufRead>(readers: &mut [(T, &String)], settings: &Settings) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Iterate over bytes in the file, in reverse, until we find the
|
||||
|
@ -475,7 +475,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
fn unbounded_tail<T: Read>(reader: &mut BufReader<T>, settings: &Settings) {
|
||||
fn unbounded_tail<T: Read>(reader: &mut BufReader<T>, settings: &Settings) -> UResult<()> {
|
||||
// Read through each line/char and store them in a ringbuffer that always
|
||||
// contains count lines/chars. When reaching the end of file, output the
|
||||
// data in the ringbuf.
|
||||
|
@ -487,11 +487,13 @@ fn unbounded_tail<T: Read>(reader: &mut BufReader<T>, settings: &Settings) {
|
|||
}
|
||||
FilterMode::Bytes(count) => {
|
||||
for byte in unbounded_tail_collect(reader.bytes(), count, settings.beginning) {
|
||||
let mut stdout = stdout();
|
||||
print_byte(&mut stdout, byte);
|
||||
if let Err(err) = stdout().write(&[byte]) {
|
||||
return Err(USimpleError::new(1, err.to_string()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn is_seekable<T: Seek>(file: &mut T) -> bool {
|
||||
|
@ -500,13 +502,6 @@ fn is_seekable<T: Seek>(file: &mut T) -> bool {
|
|||
&& file.seek(SeekFrom::Start(0)).is_ok()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn print_byte<T: Write>(stdout: &mut T, ch: u8) {
|
||||
if let Err(err) = stdout.write(&[ch]) {
|
||||
crash!(1, "{}", err);
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_num(src: &str) -> Result<(usize, bool), ParseSizeError> {
|
||||
let mut size_string = src.trim();
|
||||
let mut starting_with = false;
|
||||
|
|
|
@ -26,5 +26,4 @@ name = "tee"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -28,5 +28,4 @@ name = "test"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "tr"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "truncate"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -24,5 +24,4 @@ name = "tsort"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -10,11 +10,9 @@
|
|||
|
||||
// spell-checker:ignore (ToDO) nodename kernelname kernelrelease kernelversion sysname hwplatform mnrsv
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{crate_version, App, Arg};
|
||||
use platform_info::*;
|
||||
use uucore::error::{FromIo, UResult};
|
||||
|
||||
const ABOUT: &str = "Print certain system information. With no OPTION, same as -s.";
|
||||
|
||||
|
@ -49,11 +47,13 @@ const HOST_OS: &str = "Fuchsia";
|
|||
#[cfg(target_os = "redox")]
|
||||
const HOST_OS: &str = "Redox";
|
||||
|
||||
pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = format!("{} [OPTION]...", uucore::execution_phrase());
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
let uname = crash_if_err!(1, PlatformInfo::new());
|
||||
let uname =
|
||||
PlatformInfo::new().map_err_context(|| "failed to create PlatformInfo".to_string())?;
|
||||
let mut output = String::new();
|
||||
|
||||
let all = matches.is_present(options::ALL);
|
||||
|
@ -115,7 +115,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
}
|
||||
println!("{}", output.trim_end());
|
||||
|
||||
0
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app() -> App<'static, 'static> {
|
||||
|
|
|
@ -25,5 +25,4 @@ name = "unexpand"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -26,5 +26,4 @@ name = "uniq"
|
|||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
# Necessary for "make all"
|
||||
normal = ["uucore_procs"]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -291,7 +291,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();
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue