Merge branch 'master' of github.com:uutils/coreutils into hbina-rm-silently-accept-presume-input-tty

This commit is contained in:
Hanif Bin Ariffin
2021-11-04 16:57:14 +08:00
467 changed files with 21082 additions and 6737 deletions
-21
View File
@@ -1,21 +0,0 @@
env:
# Temporary workaround for error `error: sysinfo not supported on
# this platform` seen on FreeBSD platforms, affecting Rustup
#
# References: https://github.com/rust-lang/rustup/issues/2774
RUSTUP_IO_THREADS: 1
task:
name: stable x86_64-unknown-freebsd-12
freebsd_instance:
image: freebsd-12-2-release-amd64
setup_script:
- pkg install -y curl gmake
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh -y --profile=minimal
build_script:
- . $HOME/.cargo/env
- cargo build
test_script:
- . $HOME/.cargo/env
- cargo test -p uucore -p coreutils
+97 -7
View File
@@ -13,8 +13,7 @@ env:
PROJECT_NAME: coreutils
PROJECT_DESC: "Core universal (cross-platform) utilities"
PROJECT_AUTH: "uutils"
RUST_MIN_SRV: "1.43.1" ## v1.43.0
RUST_COV_SRV: "2020-08-01" ## (~v1.47.0) supported rust version for code coverage; (date required/used by 'coverage') ## !maint: refactor when code coverage support is included in the stable channel
RUST_MIN_SRV: "1.47.0" ## MSRV v1.47.0
on: [push, pull_request]
@@ -102,11 +101,17 @@ jobs:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest , features: feat_os_unix }
- { os: ubuntu-latest }
- { os: macos-latest , features: feat_os_macos }
- { os: windows-latest , features: feat_os_windows }
steps:
- uses: actions/checkout@v2
- name: Install/setup prerequisites
shell: bash
run: |
case '${{ matrix.job.os }}' in
macos-latest) brew install coreutils ;; # needed for show-utils.sh
esac
- name: Initialize workflow variables
id: vars
shell: bash
@@ -115,9 +120,14 @@ 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='' ;
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi
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 `rust` toolchain
uses: actions-rs/toolchain@v1
with:
@@ -130,7 +140,7 @@ jobs:
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 ${{ 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 ; }
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
@@ -249,6 +259,8 @@ jobs:
# { 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 }
# - { os: ubuntu-18.04 , target: i586-unknown-linux-gnu , features: feat_os_unix , use-cross: use-cross } ## note: older windows platform; not required, dev-FYI only
# - { os: ubuntu-18.04 , target: i586-unknown-linux-gnu , features: feat_os_unix , use-cross: use-cross } ## note: older windows platform; not required, dev-FYI only
- { os: ubuntu-18.04 , target: i686-unknown-linux-gnu , features: feat_os_unix , use-cross: use-cross }
@@ -519,6 +531,52 @@ jobs:
n_fails=$(echo "$output" | grep "^FAIL:\s" | wc --lines)
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
env:
mem: 2048
steps:
- uses: actions/checkout@v2
- name: Prepare, build and test
id: test
uses: vmactions/freebsd-vm@v0.1.5
with:
usesh: true
prepare: pkg install -y curl gmake sudo
run: |
# Need to be run in the same block. Otherwise, we are 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/
whoami
# Needs to be done in a sudo as we are changing users
sudo -i -u cuuser sh << EOF
set -e
whoami
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile=minimal
## Info
# environment
echo "## environment"
echo "CI='${CI}'"
# tooling info display
echo "## tooling"
. $HOME/.cargo/env
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
# Clean to avoid to rsync back the files
cargo clean
EOF
coverage:
name: Code Coverage
runs-on: ${{ matrix.job.os }}
@@ -548,7 +606,7 @@ jobs:
## VARs setup
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# toolchain
TOOLCHAIN="nightly-${{ env.RUST_COV_SRV }}" ## default to "nightly" toolchain (required for certain required unstable compiler flags) ## !maint: refactor when stable channel has needed support
TOOLCHAIN="nightly" ## default to "nightly" toolchain (required for certain required unstable compiler flags) ## !maint: refactor when stable channel has needed support
# * specify gnu-type TOOLCHAIN for windows; `grcov` requires gnu-style code coverage data files
case ${{ matrix.job.os }} in windows-*) TOOLCHAIN="$TOOLCHAIN-x86_64-pc-windows-gnu" ;; esac;
# * use requested TOOLCHAIN if specified
@@ -650,3 +708,35 @@ 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
+39
View File
@@ -90,3 +90,42 @@ jobs:
with:
name: gnu-result
path: gnu-result.json
- name: Download the result
uses: dawidd6/action-download-artifact@v2
with:
workflow: GnuTests.yml
name: gnu-result
repo: uutils/coreutils
branch: master
path: dl
- name: Download the log
uses: dawidd6/action-download-artifact@v2
with:
workflow: GnuTests.yml
name: test-report
repo: uutils/coreutils
branch: master
path: dl
- name: Compare failing tests against master
shell: bash
run: |
OLD_FAILING=$(sed -n "s/^FAIL: \([[:print:]]\+\).*/\1/p" dl/test-suite.log | sort)
NEW_FAILING=$(sed -n "s/^FAIL: \([[:print:]]\+\).*/\1/p" gnu/tests/test-suite.log | sort)
for LINE in $OLD_FAILING
do
if ! grep -Fxq $LINE<<<"$NEW_FAILING"; then
echo "::warning ::Congrats! The gnu test $LINE is now passing!"
fi
done
for LINE in $NEW_FAILING
do
if ! grep -Fxq $LINE<<<"$OLD_FAILING"
then
echo "::error ::GNU test failed: $LINE. $LINE is passing on 'master'. Maybe you have to rebase?"
fi
done
- name: Compare against master results
shell: bash
run: |
mv dl/gnu-result.json master-gnu-result.json
python uutils/util/compare_gnu_result.py
+1 -1
View File
@@ -11,7 +11,7 @@ repos:
- id: rust-clippy
name: Rust clippy
description: Run cargo clippy on files included in the commit.
entry: cargo +nightly clippy --all-targets --all-features --
entry: cargo +nightly clippy --workspace --all-targets --all-features --
pass_filenames: false
types: [file, rust]
language: system
+1 -1
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/**"],
"ignorePaths": ["Cargo.lock", "target/**", "tests/**/fixtures/**", "src/uu/dd/test-resources/**"],
// 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
+38
View File
@@ -1,3 +1,4 @@
AFAICT
arity
autogenerate
autogenerated
@@ -8,10 +9,13 @@ bytewise
canonicalization
canonicalize
canonicalizing
codepoint
codepoints
colorizable
colorize
coprime
consts
conv
cyclomatic
dedup
deduplication
@@ -23,6 +27,7 @@ dev
devs
discoverability
duplicative
dsync
enqueue
errored
executable
@@ -30,17 +35,30 @@ executables
exponentiate
eval
falsey
fileio
flamegraph
fullblock
getfacl
gibi
gibibytes
glob
globbing
hardcode
hardcoded
hardcoding
hardfloat
hardlink
hardlinks
hasher
hashsums
infile
iflag
iflags
kibi
kibibytes
libacl
lcase
lossily
mebi
mebibytes
mergeable
@@ -49,8 +67,21 @@ microbenchmarks
microbenchmarking
multibyte
multicall
noatime
nocache
nocreat
noctty
noerror
nofollow
nolinks
nonblock
nonportable
nonprinting
notrunc
noxfer
ofile
oflag
oflags
peekable
performant
precompiled
@@ -68,11 +99,15 @@ seedable
semver
semiprime
semiprimes
setfacl
shortcode
shortcodes
siginfo
sigusr
subcommand
subexpression
submodule
sync
symlink
symlinks
syscall
@@ -80,12 +115,15 @@ syscalls
tokenize
toolchain
truthy
ucase
unbuffered
udeps
unescape
unintuitive
unprefixed
unportable
unsync
urand
whitespace
wordlist
wordlists
+3
View File
@@ -151,6 +151,9 @@ Sylvestre Ledru
T Jameson Little
Jameson
Little
Thomas Queiroz
Thomas
Queiroz
Tobias Bohumir Schottdorf
Tobias
Bohumir
+7
View File
@@ -8,6 +8,7 @@ csh
globstar
inotify
localtime
mksh
mountinfo
mountpoint
mtab
@@ -63,6 +64,7 @@ abspath
addprefix
addsuffix
endef
findstring
firstword
ifeq
ifneq
@@ -89,5 +91,10 @@ markdownlint
rerast
rollup
sed
selinuxenabled
sestatus
wslpath
xargs
# * directories
sbin
+30 -1
View File
@@ -9,12 +9,14 @@ aho-corasick
backtrace
blake2b_simd
bstr
bytecount
byteorder
chacha
chrono
conv
corasick
crossterm
exacl
filetime
formatteriteminfo
fsext
@@ -66,8 +68,10 @@ structs
substr
splitn
trunc
uninit
# * uutils
basenc
chcon
chgrp
chmod
@@ -105,11 +109,18 @@ whoami
# * vars/errno
errno
EACCES
EBADF
EBUSY
EEXIST
EINVAL
ENODATA
ENOENT
ENOSYS
EPERM
ENOTEMPTY
EOPNOTSUPP
EPERM
EROFS
# * vars/fcntl
F_GETFL
@@ -118,7 +129,9 @@ fcntl
vmsplice
# * vars/libc
COMFOLLOW
FILENO
FTSENT
HOSTSIZE
IDSIZE
IFBLK
@@ -151,12 +164,14 @@ SIGTERM
SYS_fdatasync
SYS_syncfs
USERSIZE
accpath
addrinfo
addrlen
blocksize
canonname
chroot
dlsym
execvp
fdatasync
freeaddrinfo
getaddrinfo
@@ -174,15 +189,18 @@ inode
inodes
isatty
lchown
pathlen
setgid
setgroups
settime
setuid
socktype
statfs
statp
statvfs
strcmp
strerror
strlen
syncfs
umask
waitpid
@@ -260,6 +278,7 @@ ULONG
ULONGLONG
UNLEN
WCHAR
WSADATA
errhandlingapi
fileapi
handleapi
@@ -274,6 +293,13 @@ winerror
winnt
winsock
# * vars/selinux
freecon
getfilecon
lgetfilecon
lsetfilecon
setfilecon
# * vars/uucore
optflag
optflagmulti
@@ -298,3 +324,6 @@ uucore_procs
uumain
uutil
uutils
# * function names
getcwd
-2
View File
@@ -1,2 +0,0 @@
{
}
Generated
+699 -191
View File
File diff suppressed because it is too large Load Diff
+132 -105
View File
@@ -1,9 +1,11 @@
# coreutils (uutils)
# * see the repository LICENSE, README, and CONTRIBUTING files for more information
# spell-checker:ignore (libs) libselinux
[package]
name = "coreutils"
version = "0.0.7"
version = "0.0.8"
authors = ["uutils developers"]
license = "MIT"
description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust"
@@ -33,6 +35,7 @@ feat_common_core = [
"base32",
"base64",
"basename",
"basenc",
"cat",
"cksum",
"comm",
@@ -43,6 +46,7 @@ feat_common_core = [
"df",
"dircolors",
"dirname",
"dd",
"du",
"echo",
"env",
@@ -91,8 +95,10 @@ feat_common_core = [
"true",
"truncate",
"tsort",
"touch",
"unexpand",
"uniq",
"unlink",
"wc",
"yes",
]
@@ -138,6 +144,16 @@ feat_os_unix_musl = [
#
"feat_require_unix",
]
# "feat_selinux" == set of utilities providing support for SELinux Security Context if enabled with `--features feat_selinux`.
# NOTE:
# The selinux(-sys) crate requires `libselinux` headers and shared library to be accessible in the C toolchain at compile time.
# Running a uutils compiled with `feat_selinux` requires an SELinux enabled Kernel at run time.
feat_selinux = ["cp/selinux", "id/selinux", "ls/selinux", "selinux", "feat_require_selinux"]
# "feat_acl" == set of utilities providing support for acl (access control lists) if enabled with `--features feat_acl`.
# NOTE:
# On linux, the posix-acl/acl-sys crate requires `libacl` headers and shared library to be accessible in the C toolchain at compile time.
# On FreeBSD and macOS this is not required.
feat_acl = ["cp/feat_acl"]
## feature sets with requirements (restricting cross-platform availability)
#
# ** NOTE: these `feat_require_...` sets should be minimized as much as possible to encourage cross-platform availability of utilities
@@ -167,7 +183,6 @@ feat_require_unix = [
"timeout",
"tty",
"uname",
"unlink",
]
# "feat_require_unix_utmpx" == set of utilities requiring unix utmp/utmpx support
# * ref: <https://wiki.musl-libc.org/faq.html#Q:-Why-is-the-utmp/wtmp-functionality-only-implemented-as-stubs?>
@@ -177,6 +192,11 @@ feat_require_unix_utmpx = [
"users",
"who",
]
# "feat_require_selinux" == set of utilities depending on SELinux.
feat_require_selinux = [
"chcon",
"runcon",
]
## (alternate/newer/smaller platforms) feature sets
# "feat_os_unix_fuchsia" == set of utilities which can be built/run on the "Fuchsia" OS (refs: <https://fuchsia.dev>; <https://en.wikipedia.org/wiki/Google_Fuchsia>)
feat_os_unix_fuchsia = [
@@ -204,9 +224,8 @@ feat_os_unix_fuchsia = [
feat_os_unix_redox = [
"feat_common_core",
#
"uname",
"chmod",
"install",
"uname",
]
# "feat_os_windows_legacy" == slightly restricted set of utilities which can be built/run on early windows platforms (eg, "WinXP")
feat_os_windows_legacy = [
@@ -227,106 +246,111 @@ test = [ "uu_test" ]
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
lazy_static = { version="1.3" }
textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review
uucore = { version=">=0.0.9", package="uucore", path="src/uucore" }
textwrap = { version="0.14", features=["terminal_size"] }
uucore = { version=">=0.0.10", package="uucore", path="src/uucore" }
selinux = { version="0.2.3", optional = true }
# * uutils
uu_test = { optional=true, version="0.0.7", package="uu_test", path="src/uu/test" }
uu_test = { optional=true, version="0.0.8", package="uu_test", path="src/uu/test" }
#
arch = { optional=true, version="0.0.7", package="uu_arch", path="src/uu/arch" }
base32 = { optional=true, version="0.0.7", package="uu_base32", path="src/uu/base32" }
base64 = { optional=true, version="0.0.7", package="uu_base64", path="src/uu/base64" }
basename = { optional=true, version="0.0.7", package="uu_basename", path="src/uu/basename" }
cat = { optional=true, version="0.0.7", package="uu_cat", path="src/uu/cat" }
chgrp = { optional=true, version="0.0.7", package="uu_chgrp", path="src/uu/chgrp" }
chmod = { optional=true, version="0.0.7", package="uu_chmod", path="src/uu/chmod" }
chown = { optional=true, version="0.0.7", package="uu_chown", path="src/uu/chown" }
chroot = { optional=true, version="0.0.7", package="uu_chroot", path="src/uu/chroot" }
cksum = { optional=true, version="0.0.7", package="uu_cksum", path="src/uu/cksum" }
comm = { optional=true, version="0.0.7", package="uu_comm", path="src/uu/comm" }
cp = { optional=true, version="0.0.7", package="uu_cp", path="src/uu/cp" }
csplit = { optional=true, version="0.0.7", package="uu_csplit", path="src/uu/csplit" }
cut = { optional=true, version="0.0.7", package="uu_cut", path="src/uu/cut" }
date = { optional=true, version="0.0.7", package="uu_date", path="src/uu/date" }
df = { optional=true, version="0.0.7", package="uu_df", path="src/uu/df" }
dircolors= { optional=true, version="0.0.7", package="uu_dircolors", path="src/uu/dircolors" }
dirname = { optional=true, version="0.0.7", package="uu_dirname", path="src/uu/dirname" }
du = { optional=true, version="0.0.7", package="uu_du", path="src/uu/du" }
echo = { optional=true, version="0.0.7", package="uu_echo", path="src/uu/echo" }
env = { optional=true, version="0.0.7", package="uu_env", path="src/uu/env" }
expand = { optional=true, version="0.0.7", package="uu_expand", path="src/uu/expand" }
expr = { optional=true, version="0.0.7", package="uu_expr", path="src/uu/expr" }
factor = { optional=true, version="0.0.7", package="uu_factor", path="src/uu/factor" }
false = { optional=true, version="0.0.7", package="uu_false", path="src/uu/false" }
fmt = { optional=true, version="0.0.7", package="uu_fmt", path="src/uu/fmt" }
fold = { optional=true, version="0.0.7", package="uu_fold", path="src/uu/fold" }
groups = { optional=true, version="0.0.7", package="uu_groups", path="src/uu/groups" }
hashsum = { optional=true, version="0.0.7", package="uu_hashsum", path="src/uu/hashsum" }
head = { optional=true, version="0.0.7", package="uu_head", path="src/uu/head" }
hostid = { optional=true, version="0.0.7", package="uu_hostid", path="src/uu/hostid" }
hostname = { optional=true, version="0.0.7", package="uu_hostname", path="src/uu/hostname" }
id = { optional=true, version="0.0.7", package="uu_id", path="src/uu/id" }
install = { optional=true, version="0.0.7", package="uu_install", path="src/uu/install" }
join = { optional=true, version="0.0.7", package="uu_join", path="src/uu/join" }
kill = { optional=true, version="0.0.7", package="uu_kill", path="src/uu/kill" }
link = { optional=true, version="0.0.7", package="uu_link", path="src/uu/link" }
ln = { optional=true, version="0.0.7", package="uu_ln", path="src/uu/ln" }
ls = { optional=true, version="0.0.7", package="uu_ls", path="src/uu/ls" }
logname = { optional=true, version="0.0.7", package="uu_logname", path="src/uu/logname" }
mkdir = { optional=true, version="0.0.7", package="uu_mkdir", path="src/uu/mkdir" }
mkfifo = { optional=true, version="0.0.7", package="uu_mkfifo", path="src/uu/mkfifo" }
mknod = { optional=true, version="0.0.7", package="uu_mknod", path="src/uu/mknod" }
mktemp = { optional=true, version="0.0.7", package="uu_mktemp", path="src/uu/mktemp" }
more = { optional=true, version="0.0.7", package="uu_more", path="src/uu/more" }
mv = { optional=true, version="0.0.7", package="uu_mv", path="src/uu/mv" }
nice = { optional=true, version="0.0.7", package="uu_nice", path="src/uu/nice" }
nl = { optional=true, version="0.0.7", package="uu_nl", path="src/uu/nl" }
nohup = { optional=true, version="0.0.7", package="uu_nohup", path="src/uu/nohup" }
nproc = { optional=true, version="0.0.7", package="uu_nproc", path="src/uu/nproc" }
numfmt = { optional=true, version="0.0.7", package="uu_numfmt", path="src/uu/numfmt" }
od = { optional=true, version="0.0.7", package="uu_od", path="src/uu/od" }
paste = { optional=true, version="0.0.7", package="uu_paste", path="src/uu/paste" }
pathchk = { optional=true, version="0.0.7", package="uu_pathchk", path="src/uu/pathchk" }
pinky = { optional=true, version="0.0.7", package="uu_pinky", path="src/uu/pinky" }
pr = { optional=true, version="0.0.7", package="uu_pr", path="src/uu/pr" }
printenv = { optional=true, version="0.0.7", package="uu_printenv", path="src/uu/printenv" }
printf = { optional=true, version="0.0.7", package="uu_printf", path="src/uu/printf" }
ptx = { optional=true, version="0.0.7", package="uu_ptx", path="src/uu/ptx" }
pwd = { optional=true, version="0.0.7", package="uu_pwd", path="src/uu/pwd" }
readlink = { optional=true, version="0.0.7", package="uu_readlink", path="src/uu/readlink" }
realpath = { optional=true, version="0.0.7", package="uu_realpath", path="src/uu/realpath" }
relpath = { optional=true, version="0.0.7", package="uu_relpath", path="src/uu/relpath" }
rm = { optional=true, version="0.0.7", package="uu_rm", path="src/uu/rm" }
rmdir = { optional=true, version="0.0.7", package="uu_rmdir", path="src/uu/rmdir" }
seq = { optional=true, version="0.0.7", package="uu_seq", path="src/uu/seq" }
shred = { optional=true, version="0.0.7", package="uu_shred", path="src/uu/shred" }
shuf = { optional=true, version="0.0.7", package="uu_shuf", path="src/uu/shuf" }
sleep = { optional=true, version="0.0.7", package="uu_sleep", path="src/uu/sleep" }
sort = { optional=true, version="0.0.7", package="uu_sort", path="src/uu/sort" }
split = { optional=true, version="0.0.7", package="uu_split", path="src/uu/split" }
stat = { optional=true, version="0.0.7", package="uu_stat", path="src/uu/stat" }
stdbuf = { optional=true, version="0.0.7", package="uu_stdbuf", path="src/uu/stdbuf" }
sum = { optional=true, version="0.0.7", package="uu_sum", path="src/uu/sum" }
sync = { optional=true, version="0.0.7", package="uu_sync", path="src/uu/sync" }
tac = { optional=true, version="0.0.7", package="uu_tac", path="src/uu/tac" }
tail = { optional=true, version="0.0.7", package="uu_tail", path="src/uu/tail" }
tee = { optional=true, version="0.0.7", package="uu_tee", path="src/uu/tee" }
timeout = { optional=true, version="0.0.7", package="uu_timeout", path="src/uu/timeout" }
touch = { optional=true, version="0.0.7", package="uu_touch", path="src/uu/touch" }
tr = { optional=true, version="0.0.7", package="uu_tr", path="src/uu/tr" }
true = { optional=true, version="0.0.7", package="uu_true", path="src/uu/true" }
truncate = { optional=true, version="0.0.7", package="uu_truncate", path="src/uu/truncate" }
tsort = { optional=true, version="0.0.7", package="uu_tsort", path="src/uu/tsort" }
tty = { optional=true, version="0.0.7", package="uu_tty", path="src/uu/tty" }
uname = { optional=true, version="0.0.7", package="uu_uname", path="src/uu/uname" }
unexpand = { optional=true, version="0.0.7", package="uu_unexpand", path="src/uu/unexpand" }
uniq = { optional=true, version="0.0.7", package="uu_uniq", path="src/uu/uniq" }
unlink = { optional=true, version="0.0.7", package="uu_unlink", path="src/uu/unlink" }
uptime = { optional=true, version="0.0.7", package="uu_uptime", path="src/uu/uptime" }
users = { optional=true, version="0.0.7", package="uu_users", path="src/uu/users" }
wc = { optional=true, version="0.0.7", package="uu_wc", path="src/uu/wc" }
who = { optional=true, version="0.0.7", package="uu_who", path="src/uu/who" }
whoami = { optional=true, version="0.0.7", package="uu_whoami", path="src/uu/whoami" }
yes = { optional=true, version="0.0.7", package="uu_yes", path="src/uu/yes" }
arch = { optional=true, version="0.0.8", package="uu_arch", path="src/uu/arch" }
base32 = { optional=true, version="0.0.8", package="uu_base32", path="src/uu/base32" }
base64 = { optional=true, version="0.0.8", package="uu_base64", path="src/uu/base64" }
basename = { optional=true, version="0.0.8", package="uu_basename", path="src/uu/basename" }
basenc = { optional=true, version="0.0.8", package="uu_basenc", path="src/uu/basenc" }
cat = { optional=true, version="0.0.8", package="uu_cat", path="src/uu/cat" }
chcon = { optional=true, version="0.0.8", package="uu_chcon", path="src/uu/chcon" }
chgrp = { optional=true, version="0.0.8", package="uu_chgrp", path="src/uu/chgrp" }
chmod = { optional=true, version="0.0.8", package="uu_chmod", path="src/uu/chmod" }
chown = { optional=true, version="0.0.8", package="uu_chown", path="src/uu/chown" }
chroot = { optional=true, version="0.0.8", package="uu_chroot", path="src/uu/chroot" }
cksum = { optional=true, version="0.0.8", package="uu_cksum", path="src/uu/cksum" }
comm = { optional=true, version="0.0.8", package="uu_comm", path="src/uu/comm" }
cp = { optional=true, version="0.0.8", package="uu_cp", path="src/uu/cp" }
csplit = { optional=true, version="0.0.8", package="uu_csplit", path="src/uu/csplit" }
cut = { optional=true, version="0.0.8", package="uu_cut", path="src/uu/cut" }
date = { optional=true, version="0.0.8", package="uu_date", path="src/uu/date" }
dd = { optional=true, version="0.0.8", package="uu_dd", path="src/uu/dd" }
df = { optional=true, version="0.0.8", package="uu_df", path="src/uu/df" }
dircolors= { optional=true, version="0.0.8", package="uu_dircolors", path="src/uu/dircolors" }
dirname = { optional=true, version="0.0.8", package="uu_dirname", path="src/uu/dirname" }
du = { optional=true, version="0.0.8", package="uu_du", path="src/uu/du" }
echo = { optional=true, version="0.0.8", package="uu_echo", path="src/uu/echo" }
env = { optional=true, version="0.0.8", package="uu_env", path="src/uu/env" }
expand = { optional=true, version="0.0.8", package="uu_expand", path="src/uu/expand" }
expr = { optional=true, version="0.0.8", package="uu_expr", path="src/uu/expr" }
factor = { optional=true, version="0.0.8", package="uu_factor", path="src/uu/factor" }
false = { optional=true, version="0.0.8", package="uu_false", path="src/uu/false" }
fmt = { optional=true, version="0.0.8", package="uu_fmt", path="src/uu/fmt" }
fold = { optional=true, version="0.0.8", package="uu_fold", path="src/uu/fold" }
groups = { optional=true, version="0.0.8", package="uu_groups", path="src/uu/groups" }
hashsum = { optional=true, version="0.0.8", package="uu_hashsum", path="src/uu/hashsum" }
head = { optional=true, version="0.0.8", package="uu_head", path="src/uu/head" }
hostid = { optional=true, version="0.0.8", package="uu_hostid", path="src/uu/hostid" }
hostname = { optional=true, version="0.0.8", package="uu_hostname", path="src/uu/hostname" }
id = { optional=true, version="0.0.8", package="uu_id", path="src/uu/id" }
install = { optional=true, version="0.0.8", package="uu_install", path="src/uu/install" }
join = { optional=true, version="0.0.8", package="uu_join", path="src/uu/join" }
kill = { optional=true, version="0.0.8", package="uu_kill", path="src/uu/kill" }
link = { optional=true, version="0.0.8", package="uu_link", path="src/uu/link" }
ln = { optional=true, version="0.0.8", package="uu_ln", path="src/uu/ln" }
ls = { optional=true, version="0.0.8", package="uu_ls", path="src/uu/ls" }
logname = { optional=true, version="0.0.8", package="uu_logname", path="src/uu/logname" }
mkdir = { optional=true, version="0.0.8", package="uu_mkdir", path="src/uu/mkdir" }
mkfifo = { optional=true, version="0.0.8", package="uu_mkfifo", path="src/uu/mkfifo" }
mknod = { optional=true, version="0.0.8", package="uu_mknod", path="src/uu/mknod" }
mktemp = { optional=true, version="0.0.8", package="uu_mktemp", path="src/uu/mktemp" }
more = { optional=true, version="0.0.8", package="uu_more", path="src/uu/more" }
mv = { optional=true, version="0.0.8", package="uu_mv", path="src/uu/mv" }
nice = { optional=true, version="0.0.8", package="uu_nice", path="src/uu/nice" }
nl = { optional=true, version="0.0.8", package="uu_nl", path="src/uu/nl" }
nohup = { optional=true, version="0.0.8", package="uu_nohup", path="src/uu/nohup" }
nproc = { optional=true, version="0.0.8", package="uu_nproc", path="src/uu/nproc" }
numfmt = { optional=true, version="0.0.8", package="uu_numfmt", path="src/uu/numfmt" }
od = { optional=true, version="0.0.8", package="uu_od", path="src/uu/od" }
paste = { optional=true, version="0.0.8", package="uu_paste", path="src/uu/paste" }
pathchk = { optional=true, version="0.0.8", package="uu_pathchk", path="src/uu/pathchk" }
pinky = { optional=true, version="0.0.8", package="uu_pinky", path="src/uu/pinky" }
pr = { optional=true, version="0.0.8", package="uu_pr", path="src/uu/pr" }
printenv = { optional=true, version="0.0.8", package="uu_printenv", path="src/uu/printenv" }
printf = { optional=true, version="0.0.8", package="uu_printf", path="src/uu/printf" }
ptx = { optional=true, version="0.0.8", package="uu_ptx", path="src/uu/ptx" }
pwd = { optional=true, version="0.0.8", package="uu_pwd", path="src/uu/pwd" }
readlink = { optional=true, version="0.0.8", package="uu_readlink", path="src/uu/readlink" }
realpath = { optional=true, version="0.0.8", package="uu_realpath", path="src/uu/realpath" }
relpath = { optional=true, version="0.0.8", package="uu_relpath", path="src/uu/relpath" }
rm = { optional=true, version="0.0.8", package="uu_rm", path="src/uu/rm" }
rmdir = { optional=true, version="0.0.8", package="uu_rmdir", path="src/uu/rmdir" }
runcon = { optional=true, version="0.0.8", package="uu_runcon", path="src/uu/runcon" }
seq = { optional=true, version="0.0.8", package="uu_seq", path="src/uu/seq" }
shred = { optional=true, version="0.0.8", package="uu_shred", path="src/uu/shred" }
shuf = { optional=true, version="0.0.8", package="uu_shuf", path="src/uu/shuf" }
sleep = { optional=true, version="0.0.8", package="uu_sleep", path="src/uu/sleep" }
sort = { optional=true, version="0.0.8", package="uu_sort", path="src/uu/sort" }
split = { optional=true, version="0.0.8", package="uu_split", path="src/uu/split" }
stat = { optional=true, version="0.0.8", package="uu_stat", path="src/uu/stat" }
stdbuf = { optional=true, version="0.0.8", package="uu_stdbuf", path="src/uu/stdbuf" }
sum = { optional=true, version="0.0.8", package="uu_sum", path="src/uu/sum" }
sync = { optional=true, version="0.0.8", package="uu_sync", path="src/uu/sync" }
tac = { optional=true, version="0.0.8", package="uu_tac", path="src/uu/tac" }
tail = { optional=true, version="0.0.8", package="uu_tail", path="src/uu/tail" }
tee = { optional=true, version="0.0.8", package="uu_tee", path="src/uu/tee" }
timeout = { optional=true, version="0.0.8", package="uu_timeout", path="src/uu/timeout" }
touch = { optional=true, version="0.0.8", package="uu_touch", path="src/uu/touch" }
tr = { optional=true, version="0.0.8", package="uu_tr", path="src/uu/tr" }
true = { optional=true, version="0.0.8", package="uu_true", path="src/uu/true" }
truncate = { optional=true, version="0.0.8", package="uu_truncate", path="src/uu/truncate" }
tsort = { optional=true, version="0.0.8", package="uu_tsort", path="src/uu/tsort" }
tty = { optional=true, version="0.0.8", package="uu_tty", path="src/uu/tty" }
uname = { optional=true, version="0.0.8", package="uu_uname", path="src/uu/uname" }
unexpand = { optional=true, version="0.0.8", package="uu_unexpand", path="src/uu/unexpand" }
uniq = { optional=true, version="0.0.8", package="uu_uniq", path="src/uu/uniq" }
unlink = { optional=true, version="0.0.8", package="uu_unlink", path="src/uu/unlink" }
uptime = { optional=true, version="0.0.8", package="uu_uptime", path="src/uu/uptime" }
users = { optional=true, version="0.0.8", package="uu_users", path="src/uu/users" }
wc = { optional=true, version="0.0.8", package="uu_wc", path="src/uu/wc" }
who = { optional=true, version="0.0.8", package="uu_who", path="src/uu/who" }
whoami = { optional=true, version="0.0.8", package="uu_whoami", path="src/uu/whoami" }
yes = { optional=true, version="0.0.8", package="uu_yes", path="src/uu/yes" }
# this breaks clippy linting with: "tests/by-util/test_factor_benches.rs: No such file or directory (os error 2)"
# factor_benches = { optional = true, version = "0.0.0", package = "uu_factor_benches", path = "tests/benches/factor" }
@@ -342,7 +366,6 @@ conv = "0.3"
filetime = "0.2"
glob = "0.3.0"
libc = "0.2"
nix = "0.20.0"
pretty_assertions = "0.7.2"
rand = "0.7"
regex = "1.0"
@@ -350,12 +373,16 @@ sha1 = { version="0.6", features=["std"] }
tempfile = "3.2.0"
time = "0.1"
unindent = "0.1"
uucore = { version=">=0.0.9", package="uucore", path="src/uucore", features=["entries", "process"] }
uucore = { version=">=0.0.10", package="uucore", path="src/uucore", features=["entries", "process"] }
walkdir = "2.2"
atty = "0.2"
[target.'cfg(unix)'.dev-dependencies]
[target.'cfg(target_os = "linux")'.dev-dependencies]
rlimit = "0.4.0"
[target.'cfg(unix)'.dev-dependencies]
nix = "0.20.0"
rust-users = { version="0.10", package="users" }
unix_socket = "0.5.0"
+26
View File
@@ -1,3 +1,29 @@
Documentation
-------------
The source of the documentation is available on:
https://uutils.github.io/coreutils-docs/coreutils/
The documentation is updated everyday on this repository:
https://github.com/uutils/coreutils-docs
Running GNU tests
-----------------
<!-- spell-checker:ignore gnulib -->
- Check out https://github.com/coreutils/coreutils next to your fork as gnu
- Check out https://github.com/coreutils/gnulib next to your fork as gnulib
- Rename the checkout of your fork to uutils
At the end you should have uutils, gnu and gnulib checked out next to each other.
- Run `cd uutils && ./util/build-gnu.sh && cd ..` to get everything ready (this may take a while)
- Finally, you can run `tests with bash uutils/util/run-gnu-test.sh <test>`. Instead of `<test>` insert the test you want to run, e.g. `tests/misc/wc-proc`.
Code Coverage Report Generation
---------------------------------
+22
View File
@@ -46,6 +46,15 @@ BUSYBOX_ROOT := $(BASEDIR)/tmp
BUSYBOX_VER := 1.32.1
BUSYBOX_SRC := $(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER)
ifeq ($(SELINUX_ENABLED),)
SELINUX_ENABLED := 0
ifneq ($(OS),Windows_NT)
ifeq ($(shell /sbin/selinuxenabled 2>/dev/null ; echo $$?),0)
SELINUX_ENABLED := 1
endif
endif
endif
# Possible programs
PROGS := \
base32 \
@@ -147,10 +156,18 @@ UNIX_PROGS := \
users \
who
SELINUX_PROGS := \
chcon \
runcon
ifneq ($(OS),Windows_NT)
PROGS := $(PROGS) $(UNIX_PROGS)
endif
ifeq ($(SELINUX_ENABLED),1)
PROGS := $(PROGS) $(SELINUX_PROGS)
endif
UTILS ?= $(PROGS)
# Programs with usable tests
@@ -159,6 +176,7 @@ TEST_PROGS := \
base64 \
basename \
cat \
chcon \
chgrp \
chmod \
chown \
@@ -199,6 +217,7 @@ TEST_PROGS := \
realpath \
rm \
rmdir \
runcon \
seq \
sort \
split \
@@ -228,6 +247,9 @@ TEST_SPEC_FEATURE :=
ifneq ($(SPEC),)
TEST_NO_FAIL_FAST :=--no-fail-fast
TEST_SPEC_FEATURE := test_unimplemented
else ifeq ($(SELINUX_ENABLED),1)
TEST_NO_FAIL_FAST :=
TEST_SPEC_FEATURE := feat_selinux
endif
define TEST_BUSYBOX
+20 -17
View File
@@ -39,7 +39,7 @@ to compile anywhere, and this is as good a way as any to try and learn it.
### Rust Version
uutils follows Rust's release channels and is tested against stable, beta and nightly.
The current oldest supported version of the Rust compiler is `1.43.1`.
The current oldest supported version of the Rust compiler is `1.47`.
On both Windows and Redox, only the nightly version is tested currently.
@@ -365,23 +365,25 @@ To contribute to uutils, please see [CONTRIBUTING](CONTRIBUTING.md).
| Done | Semi-Done | To Do |
|-----------|-----------|--------|
| arch | cp | chcon |
| base32 | date | dd |
| base64 | df | runcon |
| basename | expr | stty |
| arch | cp | stty |
| base32 | date | |
| base64 | dd | |
| basename | df | |
| basenc | expr | |
| cat | install | |
| chgrp | join | |
| chmod | ls | |
| chown | more | |
| chroot | numfmt | |
| cksum | od (`--strings` and 128-bit data types missing) | |
| comm | pr | |
| csplit | printf | |
| cut | sort | |
| dircolors | split | |
| dirname | tac | |
| du | tail | |
| echo | test | |
| chcon | join | |
| chgrp | ls | |
| chmod | more | |
| chown | numfmt | |
| chroot | od (`--strings` and 128-bit data types missing) | |
| cksum | pr | |
| comm | printf | |
| csplit | sort | |
| cut | split | |
| dircolors | tac | |
| dirname | tail | |
| du | test | |
| echo | | |
| env | | |
| expand | | |
| factor | | |
@@ -424,6 +426,7 @@ To contribute to uutils, please see [CONTRIBUTING](CONTRIBUTING.md).
| relpath | | |
| rm | | |
| rmdir | | |
| runcon | | |
| seq | | |
| shred | | |
| shuf | | |
+4 -2
View File
@@ -28,8 +28,8 @@ pub fn main() {
if val == "1" && key.starts_with(env_feature_prefix) {
let krate = key[env_feature_prefix.len()..].to_lowercase();
match krate.as_ref() {
"default" | "macos" | "unix" | "windows" => continue, // common/standard feature names
"nightly" | "test_unimplemented" => continue, // crate-local custom features
"default" | "macos" | "unix" | "windows" | "selinux" => continue, // common/standard feature names
"nightly" | "test_unimplemented" => continue, // crate-local custom features
"test" => continue, // over-ridden with 'uu_test' to avoid collision with rust core crate 'test'
s if s.starts_with(feature_prefix) => continue, // crate feature sets
_ => {} // util feature name
@@ -46,6 +46,8 @@ pub fn main() {
"type UtilityMap<T> = HashMap<&'static str, (fn(T) -> i32, fn() -> App<'static, 'static>)>;\n\
\n\
fn util_map<T: uucore::Args>() -> UtilityMap<T> {\n\
\t#[allow(unused_mut)]\n\
\t#[allow(clippy::let_and_return)]\n\
\tlet mut map = UtilityMap::new();\n\
"
.as_bytes(),
+1 -1
View File
@@ -1 +1 @@
msrv = "1.43.1"
msrv = "1.47.0"
+20 -10
View File
@@ -10,10 +10,12 @@ use clap::Arg;
use clap::Shell;
use std::cmp;
use std::collections::hash_map::HashMap;
use std::ffi::OsStr;
use std::ffi::OsString;
use std::io::{self, Write};
use std::path::{Path, PathBuf};
use std::process;
use uucore::display::Quotable;
const VERSION: &str = env!("CARGO_PKG_VERSION");
@@ -70,18 +72,27 @@ fn main() {
Some(OsString::from(*util))
} else {
// unmatched binary name => regard as multi-binary container and advance argument list
uucore::set_utility_is_second_arg();
args.next()
};
// 0th argument equals util name?
if let Some(util_os) = util_name {
let util = util_os.as_os_str().to_string_lossy();
fn not_found(util: &OsStr) -> ! {
println!("{}: function/utility not found", util.maybe_quote());
process::exit(1);
}
let util = match util_os.to_str() {
Some(util) => util,
None => not_found(&util_os),
};
if util == "completion" {
gen_completions(args, utils);
}
match utils.get(&util[..]) {
match utils.get(util) {
Some(&(uumain, _)) => {
process::exit(uumain((vec![util_os].into_iter()).chain(args)));
}
@@ -89,9 +100,12 @@ fn main() {
if util == "--help" || util == "-h" {
// see if they want help on a specific util
if let Some(util_os) = args.next() {
let util = util_os.as_os_str().to_string_lossy();
let util = match util_os.to_str() {
Some(util) => util,
None => not_found(&util_os),
};
match utils.get(&util[..]) {
match utils.get(util) {
Some(&(uumain, _)) => {
let code = uumain(
(vec![util_os, OsString::from("--help")].into_iter())
@@ -100,17 +114,13 @@ fn main() {
io::stdout().flush().expect("could not flush stdout");
process::exit(code);
}
None => {
println!("{}: function/utility not found", util);
process::exit(1);
}
None => not_found(&util_os),
}
}
usage(&utils, binary_as_util);
process::exit(0);
} else {
println!("{}: function/utility not found", util);
process::exit(1);
not_found(&util_os);
}
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
[package]
name = "uu_arch"
version = "0.0.7"
version = "0.0.8"
authors = ["uutils developers"]
license = "MIT"
description = "arch ~ (uutils) display machine architecture"
@@ -17,8 +17,8 @@ path = "src/arch.rs"
[dependencies]
platform-info = "0.1"
clap = { version = "2.33", features = ["wrap_help"] }
uucore = { version=">=0.0.9", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.6", package="uucore_procs", path="../../uucore_procs" }
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
[[bin]]
name = "arch"
+1 -4
View File
@@ -6,9 +6,6 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use platform_info::*;
use clap::{crate_version, App};
@@ -27,7 +24,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
pub fn uu_app() -> App<'static, 'static> {
App::new(executable!())
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.after_help(SUMMARY)

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