From 38a47b4358b2e149dcaaa02a417dc527cabb02ec Mon Sep 17 00:00:00 2001 From: Dave Hodder Date: Thu, 22 Jul 2021 17:38:43 +0100 Subject: [PATCH 1/6] CONTRIBUTING: Add Apache License note (#2086) Add a note the licensing section, stating that references using the Apache License are acceptable on a case-by-case basis when there is no MIT-licensed alternative. * Follow-up to #1994 / https://github.com/uutils/coreutils/pull/2493 * Intended to resolve issue #2086 --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c9a50cd1e..1a78d8bf0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -103,6 +103,13 @@ The following types of license are acceptable: * "MIT equivalent" license (2-clause BSD, 3-clause BSD, ISC) * License less restrictive than the MIT License (CC0 1.0 Universal) +Some licenses are similar to the above, but are not preferable because they +contain additional conditions not present in the MIT License. The following are +accepted in referenced dependencies, on a case-by-case basis, when there is no +MIT-licensed alternative: + +* Apache License version 2.0 + Licenses we will not use: * An ambiguous license, or no license From 2dc9dfe62f15eed62b1a4f66a8606e68159290f8 Mon Sep 17 00:00:00 2001 From: Dave Hodder Date: Thu, 22 Jul 2021 18:02:51 +0100 Subject: [PATCH 2/6] CONTRIBUTING: adjust formatting --- CONTRIBUTING.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1a78d8bf0..41733946b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,9 +4,10 @@ Contributions are very welcome, and should target Rust's master branch until the standard libraries are stabilized. You may *claim* an item on the to-do list by following these steps: -1. Open an issue named "Implement [the utility of your choice]", e.g. "Implement ls" +1. Open an issue named "Implement [the utility of your choice]", e.g. "Implement + ls". 1. State that you are working on this utility. -1. Develop the utility +1. Develop the utility. 1. Add integration tests. 1. Add the reference to your utility into Cargo.toml and Makefile. 1. Remove utility from the to-do list in the README. @@ -17,12 +18,20 @@ search the issues to make sure no one else is working on it. ## Best practices -1. Follow what GNU is doing in terms of options and behavior. It is recommended to look at the GNU Coreutils manual ([on the web](https://www.gnu.org/software/coreutils/manual/html_node/index.html), or locally using `info `). It is more in depth than the man pages and provides a good description of available features and their implementation details. -1. If possible, look at the GNU test suite execution in the CI and make the test work if failing. +1. Follow what GNU is doing in terms of options and behavior. It is recommended + to look at the GNU Coreutils manual ([on the + web](https://www.gnu.org/software/coreutils/manual/html_node/index.html), or + locally using `info `). It is more in depth than the man pages and + provides a good description of available features and their implementation + details. +1. If possible, look at the GNU test suite execution in the CI and make the test + work if failing. 1. Use clap for argument management. -1. Make sure that the code coverage is covering all of the cases, including errors. +1. Make sure that the code coverage is covering all of the cases, including + errors. 1. The code must be clippy-warning-free and rustfmt-compliant. -1. Don't hesitate to move common functions into uucore if they can be reused by other binaries. +1. Don't hesitate to move common functions into uucore if they can be reused by + other binaries. 1. Unsafe code should be documented with Safety comments. 1. uutils is original code. It cannot contain code from existing GNU or Unix-like utilities, nor should it link to or reference GNU libraries. @@ -99,7 +108,8 @@ project, a tool like `cargo-license` can be used to show their license details. The following types of license are acceptable: * MIT License -* Dual- or tri-license with an MIT License option ("Apache-2.0 or MIT" is a popular combination) +* Dual- or tri-license with an MIT License option ("Apache-2.0 or MIT" is a + popular combination) * "MIT equivalent" license (2-clause BSD, 3-clause BSD, ISC) * License less restrictive than the MIT License (CC0 1.0 Universal) From 3af8a89bce196e43c21c4733868d2195b626a2d0 Mon Sep 17 00:00:00 2001 From: Dave Hodder Date: Sun, 25 Jul 2021 12:27:26 +0100 Subject: [PATCH 3/6] CONTRIBUTING: Add Apache as valid license (#2086) --- CONTRIBUTING.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41733946b..2a8a80315 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -112,12 +112,6 @@ The following types of license are acceptable: popular combination) * "MIT equivalent" license (2-clause BSD, 3-clause BSD, ISC) * License less restrictive than the MIT License (CC0 1.0 Universal) - -Some licenses are similar to the above, but are not preferable because they -contain additional conditions not present in the MIT License. The following are -accepted in referenced dependencies, on a case-by-case basis, when there is no -MIT-licensed alternative: - * Apache License version 2.0 Licenses we will not use: From 9702aa6414ae2e67c781c1038d09c64791d5f486 Mon Sep 17 00:00:00 2001 From: sagu <16504129+sagudev@users.noreply.github.com> Date: Sun, 25 Jul 2021 18:06:41 +0200 Subject: [PATCH 4/6] Revert "silent buggy clippy warning" --- src/uu/arch/src/arch.rs | 3 --- src/uu/cat/src/cat.rs | 3 --- src/uu/csplit/src/csplit_error.rs | 3 --- src/uu/ls/src/ls.rs | 3 --- src/uu/mkdir/src/mkdir.rs | 3 --- src/uu/mktemp/src/mktemp.rs | 3 --- src/uu/touch/src/touch.rs | 3 --- src/uu/wc/src/wc.rs | 2 -- src/uucore/src/lib/features/encoding.rs | 3 --- 9 files changed, 26 deletions(-) diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index ef12eb82a..94ec97e98 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -6,9 +6,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 8ad563c5d..35a5308ed 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -10,9 +10,6 @@ // spell-checker:ignore (ToDO) nonprint nonblank nonprinting -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[cfg(unix)] extern crate unix_socket; #[macro_use] diff --git a/src/uu/csplit/src/csplit_error.rs b/src/uu/csplit/src/csplit_error.rs index e2f514ea9..637cf8890 100644 --- a/src/uu/csplit/src/csplit_error.rs +++ b/src/uu/csplit/src/csplit_error.rs @@ -1,6 +1,3 @@ -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - use std::io; use thiserror::Error; diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index a2c6f3481..8fcd34bed 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; #[cfg(unix)] diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index 7362601ba..a99867570 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index ef5c41abf..8a4b472aa 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -8,9 +8,6 @@ // spell-checker:ignore (paths) GPGHome -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index bfc7a4197..dd2b05d0e 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -8,9 +8,6 @@ // spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMDDhhmm -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - pub extern crate filetime; #[macro_use] diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 95d71e77a..0bcc66664 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -4,8 +4,6 @@ // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] #[macro_use] extern crate uucore; diff --git a/src/uucore/src/lib/features/encoding.rs b/src/uucore/src/lib/features/encoding.rs index 08c0d27e9..03fa0ed8b 100644 --- a/src/uucore/src/lib/features/encoding.rs +++ b/src/uucore/src/lib/features/encoding.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (strings) ABCDEFGHIJKLMNOPQRSTUVWXYZ -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - extern crate data_encoding; use self::data_encoding::{DecodeError, BASE32, BASE64}; From 4f4338f1c0290448f7e00de62bf258eb8e8ffd93 Mon Sep 17 00:00:00 2001 From: sagudev Date: Sun, 25 Jul 2021 18:51:16 +0200 Subject: [PATCH 5/6] Delete all allow(nonstandard_macro_braces) and fix other clippy warnings --- src/uu/cp/src/cp.rs | 1 - src/uu/dirname/src/dirname.rs | 3 --- src/uu/du/src/du.rs | 3 --- src/uu/echo/src/echo.rs | 3 --- src/uu/false/src/false.rs | 3 --- src/uu/hostid/src/hostid.rs | 3 --- src/uu/hostname/src/hostname.rs | 3 --- src/uu/kill/src/kill.rs | 3 --- src/uu/pwd/src/pwd.rs | 3 --- src/uu/sleep/src/sleep.rs | 3 --- src/uu/true/src/true.rs | 3 --- 11 files changed, 31 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 91ea7ef37..7c67649c2 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -55,7 +55,6 @@ use walkdir::WalkDir; use std::os::unix::fs::PermissionsExt; #[cfg(target_os = "linux")] -#[allow(clippy::missing_safety_doc)] ioctl!(write ficlone with 0x94, 9; std::os::raw::c_int); quick_error! { diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index 8d85dc85e..63ee57272 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -5,9 +5,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 61a3b8c29..9c05eb982 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index acdd22948..aae1ad10d 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -6,9 +6,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/false/src/false.rs b/src/uu/false/src/false.rs index 232431142..2d64c8376 100644 --- a/src/uu/false/src/false.rs +++ b/src/uu/false/src/false.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/hostid/src/hostid.rs b/src/uu/hostid/src/hostid.rs index 180c4d2e5..b0f68968d 100644 --- a/src/uu/hostid/src/hostid.rs +++ b/src/uu/hostid/src/hostid.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) gethostid -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index 14f8b9df2..045e43045 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) MAKEWORD addrs hashset -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index 88eb08fa7..b3f5010ca 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) signalname pids -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index c72cc64e2..37effe618 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index 1cb858a34..127804a9f 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/true/src/true.rs b/src/uu/true/src/true.rs index e6b7b9025..f84a89176 100644 --- a/src/uu/true/src/true.rs +++ b/src/uu/true/src/true.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; From 3c7940ddfd1ac751bc1bf4c71d09706437294b14 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sun, 25 Jul 2021 16:22:22 -0400 Subject: [PATCH 6/6] pathchk: remove double negation --- src/uu/pathchk/src/pathchk.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 335266456..7f728667f 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -170,7 +170,7 @@ fn check_basic(path: &[String]) -> bool { fn check_extra(path: &[String]) -> bool { // components: leading hyphens for p in path { - if !no_leading_hyphen(p) { + if p.starts_with('-') { writeln!( &mut std::io::stderr(), "leading hyphen in file name component '{}'", @@ -236,11 +236,6 @@ fn check_searchable(path: &str) -> bool { } } -// check for a hyphen at the beginning of a path segment -fn no_leading_hyphen(path_segment: &str) -> bool { - !path_segment.starts_with('-') -} - // check whether a path segment contains only valid (read: portable) characters fn check_portable_chars(path_segment: &str) -> bool { const VALID_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-";