Skip to content

Commit cd74bb8

Browse files
authored
Merge branch 'main' into modify-cp-archive-flag-behavior
2 parents a8839e7 + e523a56 commit cd74bb8

File tree

81 files changed

+1129
-523
lines changed

Some content is hidden

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

81 files changed

+1129
-523
lines changed

.github/workflows/CICD.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ env:
1717

1818
on: [push, pull_request]
1919

20+
permissions:
21+
contents: read # to fetch code (actions/checkout)
22+
2023
jobs:
2124
cargo-deny:
2225
name: Style/cargo-deny
@@ -532,6 +535,9 @@ jobs:
532535
path: size-result.json
533536

534537
build:
538+
permissions:
539+
contents: write # to create GitHub release (softprops/action-gh-release)
540+
535541
name: Build
536542
needs: [ min_version, deps ]
537543
runs-on: ${{ matrix.job.os }}
@@ -905,7 +911,7 @@ jobs:
905911
- uses: Swatinem/rust-cache@v1
906912
- name: Prepare, build and test
907913
## spell-checker:ignore (ToDO) sshfs usesh vmactions
908-
uses: vmactions/freebsd-vm@v0.2.6
914+
uses: vmactions/freebsd-vm@v0.2.9
909915
with:
910916
usesh: true
911917
# sync: sshfs

.github/workflows/GnuTests.yml

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ name: GnuTests
66

77
on: [push, pull_request]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
gnu:
1114
permissions:

.travis/redox-toolchain.sh

-7
This file was deleted.

Cargo.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bin/coreutils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn gen_completions<T: uucore::Args>(
152152
)
153153
.get_matches_from(std::iter::once(OsString::from("completion")).chain(args));
154154

155-
let utility = matches.value_of("utility").unwrap();
155+
let utility = matches.get_one::<String>("utility").unwrap();
156156
let shell = matches.get_one::<Shell>("shell").unwrap().to_owned();
157157

158158
let mut command = if utility == "coreutils" {

src/uu/base32/src/base_common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl Config {
6565
};
6666

6767
let cols = options
68-
.value_of(options::WRAP)
68+
.get_one::<String>(options::WRAP)
6969
.map(|num| {
7070
num.parse::<usize>().map_err(|_| {
7171
USimpleError::new(

src/uu/basename/src/basename.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
8282
}
8383

8484
let suffix = if opt_suffix {
85-
matches.value_of(options::SUFFIX).unwrap()
85+
matches.get_one::<String>(options::SUFFIX).unwrap()
8686
} else if !opt_multiple && name_args_count > 1 {
8787
matches
8888
.get_many::<String>(options::NAME)

src/uu/chgrp/src/chgrp.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ const USAGE: &str = "\
2626
{} [OPTION]... --reference=RFILE FILE...";
2727

2828
fn parse_gid_and_uid(matches: &ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)> {
29-
let dest_gid = if let Some(file) = matches.value_of(options::REFERENCE) {
29+
let dest_gid = if let Some(file) = matches.get_one::<String>(options::REFERENCE) {
3030
fs::metadata(&file)
3131
.map(|meta| Some(meta.gid()))
3232
.map_err_context(|| format!("failed to get attributes of {}", file.quote()))?
3333
} else {
34-
let group = matches.value_of(options::ARG_GROUP).unwrap_or_default();
34+
let group = matches
35+
.get_one::<String>(options::ARG_GROUP)
36+
.map(|s| s.as_str())
37+
.unwrap_or_default();
3538
if group.is_empty() {
3639
None
3740
} else {

src/uu/chmod/src/chmod.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use std::path::Path;
1414
use uucore::display::Quotable;
1515
use uucore::error::{ExitCode, UResult, USimpleError, UUsageError};
1616
use uucore::fs::display_permissions_unix;
17-
use uucore::fs::is_symlink;
1817
use uucore::libc::mode_t;
1918
#[cfg(not(windows))]
2019
use uucore::mode;
@@ -63,7 +62,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
6362
let verbose = matches.contains_id(options::VERBOSE);
6463
let preserve_root = matches.contains_id(options::PRESERVE_ROOT);
6564
let recursive = matches.contains_id(options::RECURSIVE);
66-
let fmode = match matches.value_of(options::REFERENCE) {
65+
let fmode = match matches.get_one::<String>(options::REFERENCE) {
6766
Some(fref) => match fs::metadata(fref) {
6867
Ok(meta) => Some(meta.mode()),
6968
Err(err) => {
@@ -75,7 +74,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
7574
},
7675
None => None,
7776
};
78-
let modes = matches.value_of(options::MODE).unwrap(); // should always be Some because required
77+
let modes = matches.get_one::<String>(options::MODE).unwrap(); // should always be Some because required
7978
let cmode = if mode_had_minus_prefix {
8079
// clap parsing is finished, now put prefix back
8180
format!("-{}", modes)
@@ -195,7 +194,7 @@ impl Chmoder {
195194
let filename = &filename[..];
196195
let file = Path::new(filename);
197196
if !file.exists() {
198-
if is_symlink(file) {
197+
if file.is_symlink() {
199198
println!(
200199
"failed to change mode of {} from 0000 (---------) to 0000 (---------)",
201200
filename.quote()
@@ -237,10 +236,10 @@ impl Chmoder {
237236

238237
fn walk_dir(&self, file_path: &Path) -> UResult<()> {
239238
let mut r = self.chmod_file(file_path);
240-
if !is_symlink(file_path) && file_path.is_dir() {
239+
if !file_path.is_symlink() && file_path.is_dir() {
241240
for dir_entry in file_path.read_dir()? {
242241
let path = dir_entry?.path();
243-
if !is_symlink(&path) {
242+
if !path.is_symlink() {
244243
r = self.walk_dir(path.as_path());
245244
}
246245
}
@@ -262,7 +261,7 @@ impl Chmoder {
262261
let fperm = match fs::metadata(file) {
263262
Ok(meta) => meta.mode() & 0o7777,
264263
Err(err) => {
265-
if is_symlink(file) {
264+
if file.is_symlink() {
266265
if self.verbose {
267266
println!(
268267
"neither symbolic link {} nor referent has been changed",

src/uu/chown/src/chown.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const USAGE: &str = "\
2626
{} [OPTION]... --reference=RFILE FILE...";
2727

2828
fn parse_gid_uid_and_filter(matches: &ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)> {
29-
let filter = if let Some(spec) = matches.value_of(options::FROM) {
29+
let filter = if let Some(spec) = matches.get_one::<String>(options::FROM) {
3030
match parse_spec(spec, ':')? {
3131
(Some(uid), None) => IfFrom::User(uid),
3232
(None, Some(gid)) => IfFrom::Group(gid),
@@ -39,13 +39,13 @@ fn parse_gid_uid_and_filter(matches: &ArgMatches) -> UResult<(Option<u32>, Optio
3939

4040
let dest_uid: Option<u32>;
4141
let dest_gid: Option<u32>;
42-
if let Some(file) = matches.value_of(options::REFERENCE) {
42+
if let Some(file) = matches.get_one::<String>(options::REFERENCE) {
4343
let meta = fs::metadata(&file)
4444
.map_err_context(|| format!("failed to get attributes of {}", file.quote()))?;
4545
dest_gid = Some(meta.gid());
4646
dest_uid = Some(meta.uid());
4747
} else {
48-
let (u, g) = parse_spec(matches.value_of(options::ARG_OWNER).unwrap(), ':')?;
48+
let (u, g) = parse_spec(matches.get_one::<String>(options::ARG_OWNER).unwrap(), ':')?;
4949
dest_uid = u;
5050
dest_gid = g;
5151
}

src/uu/chroot/src/chroot.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
4343
let default_option: &'static str = "-i";
4444
let user_shell = std::env::var("SHELL");
4545

46-
let newroot: &Path = match matches.value_of(options::NEWROOT) {
46+
let newroot: &Path = match matches.get_one::<String>(options::NEWROOT) {
4747
Some(v) => Path::new(v),
4848
None => return Err(ChrootError::MissingNewRoot.into()),
4949
};
@@ -165,10 +165,19 @@ pub fn uu_app<'a>() -> Command<'a> {
165165
}
166166

167167
fn set_context(root: &Path, options: &clap::ArgMatches) -> UResult<()> {
168-
let userspec_str = options.value_of(options::USERSPEC);
169-
let user_str = options.value_of(options::USER).unwrap_or_default();
170-
let group_str = options.value_of(options::GROUP).unwrap_or_default();
171-
let groups_str = options.value_of(options::GROUPS).unwrap_or_default();
168+
let userspec_str = options.get_one::<String>(options::USERSPEC);
169+
let user_str = options
170+
.get_one::<String>(options::USER)
171+
.map(|s| s.as_str())
172+
.unwrap_or_default();
173+
let group_str = options
174+
.get_one::<String>(options::GROUP)
175+
.map(|s| s.as_str())
176+
.unwrap_or_default();
177+
let groups_str = options
178+
.get_one::<String>(options::GROUPS)
179+
.map(|s| s.as_str())
180+
.unwrap_or_default();
172181
let skip_chdir = options.contains_id(options::SKIP_CHDIR);
173182
let userspec = match userspec_str {
174183
Some(u) => {

src/uu/comm/src/comm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ mod options {
3333

3434
fn mkdelim(col: usize, opts: &ArgMatches) -> String {
3535
let mut s = String::new();
36-
let delim = match opts.value_of(options::DELIMITER).unwrap() {
36+
let delim = match opts.get_one::<String>(options::DELIMITER).unwrap().as_str() {
3737
"" => "\0",
3838
delim => delim,
3939
};
@@ -135,8 +135,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
135135
let args = args.collect_lossy();
136136

137137
let matches = uu_app().try_get_matches_from(args)?;
138-
let filename1 = matches.value_of(options::FILE_1).unwrap();
139-
let filename2 = matches.value_of(options::FILE_2).unwrap();
138+
let filename1 = matches.get_one::<String>(options::FILE_1).unwrap();
139+
let filename2 = matches.get_one::<String>(options::FILE_2).unwrap();
140140
let mut f1 = open_file(filename1).map_err_context(|| filename1.to_string())?;
141141
let mut f2 = open_file(filename2).map_err_context(|| filename2.to_string())?;
142142

0 commit comments

Comments
 (0)